home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume89 / unix / rcs.14 < prev    next >
Text File  |  1989-11-19  |  95KB  |  3,366 lines

  1. Path: xanth!samsung!gem.mps.ohio-state.edu!apple!sun-barr!newstop!sun!swap!page
  2. From: page%swap@Sun.COM (Bob Page)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v89i229:  rcs - revision control system, Part14/14
  5. Message-ID: <128105@sun.Eng.Sun.COM>
  6. Date: 19 Nov 89 09:26:24 GMT
  7. Sender: news@sun.Eng.Sun.COM
  8. Lines: 3355
  9. Approved: page@sun.com
  10.  
  11. Submitted-by: rsbx@cbmvax.commodore.com (Raymond S. Brand)
  12. Posting-number: Volume 89, Issue 229
  13. Archive-name: unix/rcs.14
  14.  
  15. # This is a shell archive.
  16. # Remove anything above and including the cut line.
  17. # Then run the rest of the file through 'sh'.
  18. # Unpacked files will be owned by you and have default permissions.
  19. #----cut here-----cut here-----cut here-----cut here----#
  20. #!/bin/sh
  21. # shar: SHell ARchive
  22. # Run the following text through 'sh' to create:
  23. #    rcs/rcs.rcsfiles/ident.c,v
  24. #    rcs/rcs.rcsfiles/merge.sh,v
  25. #    rcs/rcs.rcsfiles/rcsmerge.c,v
  26. #    rcs/rcs_link
  27. #    readme
  28. #    readme.extras
  29. #    rsbx.lib/rsbx.lib.doc
  30. #    rsbx.lib/xc.asm
  31. #    rsbx.lib/emptymorgue.c
  32. #    rsbx.lib/waitchild.c
  33. #    rsbx.lib/childstatus.c
  34. #    rsbx.lib/orphanchildren.c
  35. #    rsbx.lib/escaping.c
  36. #    rsbx.lib/makefile
  37. #    rsbx.lib/orphanchild.c
  38. #    rsbx.lib/readme
  39. #    rsbx.lib/createfamily.c
  40. #    rsbx.lib/popen.c
  41. #    rsbx.lib/rsbx.lib.uu
  42. #    rsbx.lib/uxmain.c
  43. #    rsbx.lib/childtasking.h
  44. #    rsbx.lib/launchc.obj.uu
  45. #    rsbx.lib/ulseg.obj.uu
  46. # This is archive 14 of a 14-part kit.
  47. # This archive created: Sun Nov 19 01:12:14 1989
  48. if `test ! -d rcs`
  49. then
  50.   mkdir rcs
  51.   echo "mkdir rcs"
  52. fi
  53. if `test ! -d rcs/rcs.rcsfiles`
  54. then
  55.   mkdir rcs/rcs.rcsfiles
  56.   echo "mkdir rcs/rcs.rcsfiles"
  57. fi
  58. echo "extracting rcs/rcs.rcsfiles/ident.c,v"
  59. sed 's/^X//' << \SHAR_EOF > rcs/rcs.rcsfiles/ident.c,v
  60. Xhead     4.5;
  61. Xbranch   4.5.2;
  62. Xaccess   ;
  63. Xsymbols  amiga_rcs:4.5.2 cbmvax_source:4.5.1 uunet_june89_dist:4.5;
  64. Xlocks    ; strict;
  65. Xcomment  @ * @;
  66. X
  67. X
  68. X4.5
  69. Xdate     89.05.01.15.11.54;  author narten;  state Exp;
  70. Xbranches 4.5.1.1 4.5.2.1;
  71. Xnext     ;
  72. X
  73. X4.5.1.1
  74. Xdate     89.08.11.01.41.49;  author rsbx;  state Exp;
  75. Xbranches ;
  76. Xnext     ;
  77. X
  78. X4.5.2.1
  79. Xdate     89.10.13.19.17.33;  author rsbx;  state Exp;
  80. Xbranches ;
  81. Xnext     4.5.2.2;
  82. X
  83. X4.5.2.2
  84. Xdate     89.10.15.15.43.19;  author rsbx;  state Exp;
  85. Xbranches ;
  86. Xnext     ;
  87. X
  88. X
  89. Xdesc
  90. X@RCS identification operation.
  91. X@
  92. X
  93. X
  94. X
  95. X4.5
  96. Xlog
  97. X@checked in with -k by rsbx at 89.08.10.16.01.57.
  98. X@
  99. Xtext
  100. X@/* Copyright (C) 1982, 1988, 1989 Walter Tichy
  101. X * All rights reserved.
  102. X *
  103. X * Redistribution and use in source and binary forms are permitted
  104. X * provided that the above copyright notice and this paragraph are
  105. X * duplicated in all such forms and that any documentation,
  106. X * advertising materials, and other materials related to such
  107. X * distribution and use acknowledge that the software was developed
  108. X * by Walter Tichy.
  109. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  110. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  111. X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  112. X *
  113. X * Report all problems and direct all questions to:
  114. X *   rcs-bugs@@cs.purdue.edu
  115. X * 
  116. X
  117. X
  118. X
  119. X
  120. X
  121. X
  122. X
  123. X*/
  124. X
  125. X/*
  126. X *                     RCS identification operation
  127. X */
  128. X#ifndef lint
  129. Xstatic char rcsid[]=
  130. X"$Header: /usr/src/local/bin/rcs/src/RCS/ident.c,v 4.5 89/05/01 15:11:54 narten Exp $Purdue CS";
  131. X#endif
  132. X
  133. X/* $Log:    ident.c,v $
  134. X * Revision 4.5  89/05/01  15:11:54  narten
  135. X * changed copyright header to reflect current distribution rules
  136. X * 
  137. X * Revision 4.4  87/10/23  17:09:57  narten
  138. X * added exit(0) so exit return code would be non random
  139. X * 
  140. X * Revision 4.3  87/10/18  10:23:55  narten
  141. X * Updating version numbers. Changes relative to 1.1 are actually relative
  142. X * to 4.1
  143. X * 
  144. X * Revision 1.3  87/07/09  09:20:52  trinkle
  145. X * Added check to make sure there is at least one arg before comparing argv[1]
  146. X * with "-q".  This necessary on machines that don't allow dereferncing null
  147. X * pointers (i.e. Suns).
  148. X * 
  149. X * Revision 1.2  87/03/27  14:21:47  jenkins
  150. X * Port to suns
  151. X * 
  152. X * Revision 1.1  84/01/23  14:50:03  kcs
  153. X * Initial revision
  154. X * 
  155. X * Revision 4.1  83/05/10  16:31:02  wft
  156. X * Added option -q and input from reading stdin.
  157. X * Marker matching is now done with trymatch() (independent of keywords).
  158. X * 
  159. X * Revision 3.4  83/02/18  17:37:49  wft
  160. X * removed printing of new line after last file.
  161. X *
  162. X * Revision 3.3  82/12/04  12:48:55  wft
  163. X * Added LOCKER.
  164. X *
  165. X * Revision 3.2  82/11/28  18:24:17  wft
  166. X * removed Suffix; added ungetc to avoid skipping over trailing KDELIM.
  167. X *
  168. X * Revision 3.1  82/10/13  15:58:51  wft
  169. X * fixed type of variables receiving from getc() (char-->int).
  170. X*/
  171. X
  172. X#include  "rcsbase.h"
  173. X#define fflsbuf _flsbuf
  174. X/* redefinition of _flsbuf in putc not needed */
  175. X#ifndef lint
  176. Xstatic char rcsbaseid[] = RCSBASE;
  177. X#endif
  178. X
  179. Xextern enum markers trymatch();
  180. X
  181. Xint quietflag;
  182. X
  183. Xmain(argc, argv)
  184. Xint  argc; char  *argv[];
  185. X/*  Ident searches the named files for all occurrences
  186. X *  of the pattern $keyword:...$, where the keywords are
  187. X *  Author, Date, Header, Id, Log, RCSfile, Revision, Source, and State.
  188. X */
  189. X
  190. X{
  191. X   FILE *fp, *fopen();
  192. X
  193. X   quietflag = false;
  194. X   if (argc > 1 && strcmp("-q",argv[1])==0) {
  195. X        quietflag = true;
  196. X        argc--; argv++;
  197. X   }
  198. X
  199. X   if (argc<2) {
  200. X     if ((scanfile(stdin) == 0) && !quietflag)
  201. X        VOID fprintf(stderr, "ident warning: no id keywords in input\n");
  202. X    exit(0);
  203. X   }
  204. X
  205. X   while ( --argc > 0 ) {
  206. X      if ( (fp = fopen(*++argv, "r") ) == NULL ) {
  207. X         VOID fprintf(stderr,  "ident error: can't open %s\n", *argv);
  208. X         continue;
  209. X      } else {
  210. X         VOID printf( "%s:\n", *argv);   /*  print file name  */
  211. X     if ((scanfile(fp) == 0) && !quietflag)
  212. X        VOID fprintf(stderr, "ident warning: no id keywords in %s\n", *argv);
  213. X     if (argc>1) putchar('\n');
  214. X     VOID fclose(fp);
  215. X      }
  216. X   }
  217. X   exit(0);
  218. X}
  219. X
  220. X
  221. Xint scanfile(file)
  222. XFILE * file;
  223. X/* Function: scan an open file with descriptor file for keywords.
  224. X * Returns the number of matches.
  225. X */
  226. X{
  227. X   register int matchcount;
  228. X   register int c;
  229. X
  230. X
  231. X   matchcount = 0;
  232. X   while( (c=getc(file)) != EOF) {
  233. X      if ( (char)c==KDELIM)
  234. X     matchcount += match(file);
  235. X   }
  236. X   return matchcount;
  237. X}
  238. X
  239. X
  240. X
  241. Xmatch(fp)   /* group substring between two KDELIM's; then do pattern match */
  242. XFILE *fp;
  243. X{
  244. X   char line[keyvallength];
  245. X   register int c;
  246. X   register char * tp;
  247. X
  248. X   tp = line;
  249. X   while( (c = getc(fp)) != KDELIM ) {
  250. X      *tp++ = c;
  251. X      if ( c==EOF || c=='\n' || tp>= line+keyvallength-2)
  252. X         return(0);
  253. X   }
  254. X   *tp++ = c;     /*append trailing KDELIM*/
  255. X   *tp   = '\0';
  256. X   if (trymatch(line,true)!=Nomatch) {
  257. X        VOID fprintf(stdout,"     $%s\n",line);
  258. X        return(1);
  259. X   } else {
  260. X      /* no match; put trailing KDELIM back into input */
  261. X      VOID ungetc(c,fp );
  262. X      return(0);
  263. X   }
  264. X}
  265. X@
  266. X
  267. X
  268. X4.5.2.1
  269. Xlog
  270. X@Start of Amiga RCS port branch.
  271. X@
  272. Xtext
  273. X@d31 1
  274. Xa31 5
  275. X<<<<<<< ident.c
  276. X"$Header: /u/softeng/rsbx/rcs/amiga/RCS.cbmvax/ident.c,v 4.5.1.1 89/08/11 01:41:49 rsbx Exp Locker: rsbx $Purdue CS";
  277. X=======
  278. X"$Header: /u/softeng/rsbx/rcs/amiga/RCS/ident.c,v 1.2 89/09/17 13:34:20 rick Exp $Purdue CS";
  279. X>>>>>>> 1.2
  280. Xa34 4
  281. X<<<<<<< ident.c
  282. X * Revision 4.5.1.1  89/08/11  01:41:49  rsbx
  283. X * Start of cbmvax RCS source branch.
  284. X * 
  285. Xa35 3
  286. X * checked in with -k by rsbx at 89.08.10.16.01.57.
  287. X * 
  288. X * Revision 4.5  89/05/01  15:11:54  narten
  289. Xa36 9
  290. X=======
  291. X * Revision 1.2  89/09/17  13:34:20  rick
  292. X * Port to AmigaDos done by Rick Schaeffer (ricks@@iscuva.iscs.com)
  293. X * All changes done with conditional compile (#ifdef AMIGA).  This version
  294. X * compiles correctly with Lattice C version 5.02 or later.
  295. X * 
  296. X * Revision 1.2  88/09/03  15:07:58  rick
  297. X * Port to AmigaDos.  All done with conditional compiles
  298. X>>>>>>> 1.2
  299. X@
  300. X
  301. X
  302. X4.5.2.2
  303. Xlog
  304. X@Finished the integration of Rick Schaeffer's RCS Amiga port with the RCS
  305. Xsources I have here (and are later than the ones Rick used).
  306. X@
  307. Xtext
  308. X@d31 5
  309. Xa35 1
  310. X"$Header: /u/softeng/rsbx/rcs/amiga/RCS/ident.c,v 4.5.2.1 89/10/13 19:17:33 rsbx Exp Locker: rsbx $Purdue CS";
  311. Xd39 1
  312. Xa39 3
  313. X * Revision 4.5.2.1  89/10/13  19:17:33  rsbx
  314. X * Start of Amiga RCS port branch.
  315. X * 
  316. Xd48 9
  317. X@
  318. X
  319. X
  320. X4.5.1.1
  321. Xlog
  322. X@Start of cbmvax RCS source branch.
  323. X@
  324. Xtext
  325. X@d31 1
  326. Xa31 1
  327. X"$Header: /u/softeng/rsbx/rcs/rcs.uunet/src/RCS/ident.c,v 4.5 89/05/01 15:11:54 narten Exp $Purdue CS";
  328. Xa34 3
  329. X * Revision 4.5  89/05/01  15:11:54  narten
  330. X * checked in with -k by rsbx at 89.08.10.16.01.57.
  331. X * 
  332. X@
  333. SHAR_EOF
  334. echo "extracting rcs/rcs.rcsfiles/merge.sh,v"
  335. sed 's/^X//' << \SHAR_EOF > rcs/rcs.rcsfiles/merge.sh,v
  336. Xhead     1.3;
  337. Xbranch   1.3.2;
  338. Xaccess   ;
  339. Xsymbols  amiga_rcs:1.3.2 cbmvax_source:1.3.1 uunet_june89_dist:1.3;
  340. Xlocks    ; strict;
  341. Xcomment  @# @;
  342. X
  343. X
  344. X1.3
  345. Xdate     88.11.08.12.06.42;  author narten;  state Exp;
  346. Xbranches 1.3.1.1 1.3.2.1;
  347. Xnext     ;
  348. X
  349. X1.3.1.1
  350. Xdate     89.08.11.01.41.55;  author rsbx;  state Exp;
  351. Xbranches ;
  352. Xnext     ;
  353. X
  354. X1.3.2.1
  355. Xdate     89.10.13.19.19.40;  author rsbx;  state Exp;
  356. Xbranches ;
  357. Xnext     ;
  358. X
  359. X
  360. Xdesc
  361. X@Three-way file merge operation.
  362. X@
  363. X
  364. X
  365. X
  366. X1.3
  367. Xlog
  368. X@checked in with -k by rsbx at 89.08.10.16.05.37.
  369. X@
  370. Xtext
  371. X@
  372. X#    $Id: merge.sh,v 1.3 88/11/08 12:06:42 narten Exp $
  373. X
  374. XPATH=/bin:/usr/bin
  375. XDIFF=/bin/diff
  376. XDIFF3=/usr/local/lib/rdiff3
  377. Xp=w
  378. Xcase $1 in
  379. X-p)
  380. X    p='1,$p'
  381. X    shift
  382. Xesac
  383. X
  384. Xcase $# in
  385. X0|1|2)
  386. X    echo >&2 "merge: usage: merge [-p] file1 file2 file3"
  387. X    exit 1
  388. Xesac
  389. X
  390. Xcase $p in
  391. Xw)
  392. X    if test ! -w $1
  393. X    then
  394. X        echo >&2 "$1 not writeable"
  395. X        exit 1
  396. X    fi
  397. Xesac
  398. X
  399. Xtrap 's=$?; rm -f /tmp/d3a$$ /tmp/d3b$$; exit $s' 0
  400. Xtrap exit 1 2 3 13 15
  401. Xumask 077
  402. X
  403. X$DIFF $1 $3 >/tmp/d3a$$
  404. Xcase $? in
  405. X0|1) ;;
  406. X*) exit
  407. Xesac
  408. X
  409. X$DIFF $2 $3 >/tmp/d3b$$
  410. Xcase $? in
  411. X0|1) ;;
  412. X*) exit
  413. Xesac
  414. X
  415. X{
  416. X    $DIFF3 -E /tmp/d3a$$ /tmp/d3b$$ $1 $2 $3 $4 $5
  417. X    case $? in
  418. X    0) ;;
  419. X    1) echo >&2 merge: warning: 1 overlap during merge.;;
  420. X    *) echo >&2 merge: warning: $? overlaps during merge.
  421. X    esac
  422. X    echo $p
  423. X} | ed - $1
  424. X@
  425. X
  426. X
  427. X1.3.2.1
  428. Xlog
  429. X@Start of Amiga RCS port branch.
  430. X@
  431. Xtext
  432. X@d2 1
  433. Xa2 1
  434. X#    $Id: merge.sh,v 1.3.1.1 89/08/11 01:41:55 rsbx Exp Locker: rsbx $
  435. X@
  436. X
  437. X
  438. X1.3.1.1
  439. Xlog
  440. X@Start of cbmvax RCS source branch.
  441. X@
  442. Xtext
  443. X@@
  444. SHAR_EOF
  445. echo "extracting rcs/rcs.rcsfiles/rcsmerge.c,v"
  446. sed 's/^X//' << \SHAR_EOF > rcs/rcs.rcsfiles/rcsmerge.c,v
  447. Xhead     4.5;
  448. Xbranch   4.5.2;
  449. Xaccess   ;
  450. Xsymbols  amiga_rcs:4.5.2 cbmvax_source:4.5.1 uunet_june89_dist:4.5;
  451. Xlocks    ; strict;
  452. Xcomment  @ * @;
  453. X
  454. X
  455. X4.5
  456. Xdate     89.05.01.15.13.16;  author narten;  state Exp;
  457. Xbranches 4.5.1.1 4.5.2.1;
  458. Xnext     ;
  459. X
  460. X4.5.1.1
  461. Xdate     89.08.11.01.42.57;  author rsbx;  state Exp;
  462. Xbranches ;
  463. Xnext     ;
  464. X
  465. X4.5.2.1
  466. Xdate     89.10.13.19.19.04;  author rsbx;  state Exp;
  467. Xbranches ;
  468. Xnext     4.5.2.2;
  469. X
  470. X4.5.2.2
  471. Xdate     89.10.15.15.44.55;  author rsbx;  state Exp;
  472. Xbranches ;
  473. Xnext     ;
  474. X
  475. X
  476. Xdesc
  477. X@rcsmerge operation.
  478. X@
  479. X
  480. X
  481. X
  482. X4.5
  483. Xlog
  484. X@checked in with -k by rsbx at 89.08.10.16.22.33.
  485. X@
  486. Xtext
  487. X@/*
  488. X *                       rcsmerge operation
  489. X */
  490. X#ifndef lint
  491. Xstatic char rcsid[]=
  492. X"$Header: /usr/src/local/bin/rcs/src/RCS/rcsmerge.c,v 4.5 89/05/01 15:13:16 narten Exp $ Purdue CS";
  493. X#endif
  494. X/*****************************************************************************
  495. X *                       join 2 revisions with respect to a third
  496. X *****************************************************************************
  497. X */
  498. X
  499. X/* Copyright (C) 1982, 1988, 1989 Walter Tichy
  500. X * All rights reserved.
  501. X *
  502. X * Redistribution and use in source and binary forms are permitted
  503. X * provided that the above copyright notice and this paragraph are
  504. X * duplicated in all such forms and that any documentation,
  505. X * advertising materials, and other materials related to such
  506. X * distribution and use acknowledge that the software was developed
  507. X * by Walter Tichy.
  508. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  509. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  510. X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  511. X *
  512. X * Report all problems and direct all questions to:
  513. X *   rcs-bugs@@cs.purdue.edu
  514. X * 
  515. X
  516. X
  517. X
  518. X
  519. X
  520. X
  521. X
  522. X*/
  523. X
  524. X
  525. X
  526. X/* $Log:    rcsmerge.c,v $
  527. X * Revision 4.5  89/05/01  15:13:16  narten
  528. X * changed copyright header to reflect current distribution rules
  529. X * 
  530. X * Revision 4.4  88/11/08  12:00:47  narten
  531. X * changes from  eggert@@sm.unisys.com (Paul Eggert)
  532. X * 
  533. X * Revision 4.4  88/08/09  19:13:13  eggert
  534. X * Beware merging into a readonly file.
  535. X * Beware merging a revision to itself (no change).
  536. X * Use execv(), not system(); yield exit status like diff(1)'s.
  537. X * 
  538. X * Revision 4.3  87/10/18  10:38:02  narten
  539. X * Updating version numbers. Changes relative to version 1.1 
  540. X * actually relative to 4.1
  541. X * 
  542. X * Revision 1.3  87/09/24  14:00:31  narten
  543. X * Sources now pass through lint (if you ignore printf/sprintf/fprintf 
  544. X * warnings)
  545. X * 
  546. X * Revision 1.2  87/03/27  14:22:36  jenkins
  547. X * Port to suns
  548. X * 
  549. X * Revision 1.1  84/01/23  14:50:36  kcs
  550. X * Initial revision
  551. X * 
  552. X * Revision 4.1  83/03/28  11:14:57  wft
  553. X * Added handling of default branch.
  554. X * 
  555. X * Revision 3.3  82/12/24  15:29:00  wft
  556. X * Added call to catchsig().
  557. X *
  558. X * Revision 3.2  82/12/10  21:32:02  wft
  559. X * Replaced getdelta() with gettree(); improved error messages.
  560. X *
  561. X * Revision 3.1  82/11/28  19:27:44  wft
  562. X * Initial revision.
  563. X *
  564. X */
  565. X#include "rcsbase.h"
  566. X#ifndef lint
  567. Xstatic char rcsbaseid[] = RCSBASE;
  568. X#endif
  569. Xstatic char co[] = CO;
  570. Xstatic char merge[] = MERGE;
  571. X
  572. Xextern int  cleanup();              /* cleanup after signals                */
  573. Xextern char * mktempfile();         /*temporary file name generator         */
  574. Xextern struct hshentry * genrevs(); /*generate delta numbers                */
  575. Xextern int  nerror;                 /*counter for errors                    */
  576. X
  577. Xchar *RCSfilename;
  578. Xchar *workfilename;
  579. Xchar * temp1file, * temp2file;
  580. X
  581. Xmain (argc, argv)
  582. Xint argc; char **argv;
  583. X{
  584. X        char * cmdusage;
  585. X        int  revnums; /* counter for revision numbers given */
  586. X        int tostdout;
  587. X    int nochange;
  588. X        char * rev1, * rev2; /*revision numbers*/
  589. X    char commarg[revlength+3];
  590. X        char numericrev[revlength];   /* holds expanded revision number     */
  591. X        struct hshentry * gendeltas[hshsize];/*stores deltas to be generated*/
  592. X        struct hshentry * target;
  593. X
  594. X        catchints();
  595. X        cmdid = "rcsmerge";
  596. X        cmdusage = "command format:\n    rcsmerge -p -rrev1 -rrev2 file\n    rcsmerge -p -rrev1 file";
  597. X    revnums=0;tostdout=false;nochange=false;
  598. X
  599. X        while (--argc,++argv, argc>=1 && ((*argv)[0] == '-')) {
  600. X                switch ((*argv)[1]) {
  601. X                case 'p':
  602. X                        tostdout=true;
  603. X                        /* falls into -r */
  604. X                case 'r':
  605. X                        if ((*argv)[2]!='\0') {
  606. X                            if (revnums==0) {
  607. X                                    rev1= *argv+2; revnums=1;
  608. X                            } elif (revnums==1) {
  609. X                                    rev2= *argv+2; revnums=2;
  610. X                            } else {
  611. X                                    faterror("too many revision numbers");
  612. X                            }
  613. X                        } /* do nothing for empty -r or -p */
  614. X                        break;
  615. X
  616. X                default:
  617. X                        faterror("unknown option: %s\n%s", *argv,cmdusage);
  618. X                };
  619. X        } /* end of option processing */
  620. X
  621. X        if (argc<1) faterror("No input file\n%s",cmdusage);
  622. X        if (revnums<1) faterror("no base revision number given");
  623. X
  624. X        /* now handle all filenames */
  625. X
  626. X        if (pairfilenames(argc,argv,true,false)==1) {
  627. X
  628. X                if (argc>2 || (argc==2&&argv[1]!=nil))
  629. X                        warn("too many arguments");
  630. X                diagnose("RCS file: %s",RCSfilename);
  631. X        if (!(access(workfilename,tostdout?4:6)==0))
  632. X            nowork();
  633. X
  634. X                if (!trysema(RCSfilename,false)) goto end; /* give up */
  635. X
  636. X                gettree();  /* reads in the delta tree */
  637. X
  638. X                if (Head==nil) faterror("no revisions present");
  639. X
  640. X
  641. X                if (!expandsym(rev1,numericrev)) goto end;
  642. X                if (!(target=genrevs(numericrev, (char *)nil, (char *)nil, (char *)nil,gendeltas))) goto end;
  643. X                rev1=target->num;
  644. X                if (revnums==1)  /*get default for rev2 */
  645. X                        rev2=Dbranch!=nil?Dbranch->num:Head->num;
  646. X                if (!expandsym(rev2,numericrev)) goto end;
  647. X                if (!(target=genrevs(numericrev, (char *)nil, (char *)nil, (char *)nil,gendeltas))) goto end;
  648. X                rev2=target->num;
  649. X
  650. X        if (strcmp(rev1,rev2) == 0) {
  651. X            diagnose("Merging revision %s to itself (no change)",
  652. X                rev1
  653. X            );
  654. X            nochange = true;
  655. X            if (tostdout) {
  656. X                FILE *w = fopen(workfilename,"r");
  657. X                if (w==NULL)
  658. X                    nowork();
  659. X                fastcopy(w,stdout);
  660. X            }
  661. X            goto end;
  662. X        }
  663. X
  664. X                temp1file=mktempfile("/tmp/",TMPFILE1);
  665. X                temp2file=mktempfile("/tmp/",TMPFILE2);
  666. X
  667. X                diagnose("retrieving revision %s",rev1);
  668. X                VOID sprintf(commarg,"-p%s",rev1);
  669. X                if (run((char*)nil,temp1file, co,"-q",commarg,RCSfilename,(char*)nil)){
  670. X                        faterror("co failed");
  671. X                }
  672. X                diagnose("retrieving revision %s",rev2);
  673. X                VOID sprintf(commarg,"-p%s",rev2);
  674. X                if (run((char*)nil,temp2file, co,"-q",commarg,RCSfilename,(char*)nil)){
  675. X                        faterror("co failed");
  676. X                }
  677. X                diagnose("Merging differences between %s and %s into %s%s",
  678. X                         rev1, rev2, workfilename,
  679. X                         tostdout?"; result to stdout":"");
  680. X
  681. X                if (
  682. X              tostdout
  683. X            ? run((char*)nil,(char*)nil,merge,"-p",workfilename,temp1file,temp2file,workfilename,rev2,(char*)nil)
  684. X            : run((char*)nil,(char*)nil,merge,     workfilename,temp1file,temp2file,workfilename,rev2,(char*)nil)) {
  685. X                        faterror("merge failed");
  686. X                }
  687. X        }
  688. X
  689. Xend:
  690. X        VOID cleanup();
  691. X    exit(2*(nerror!=0) + nochange);
  692. X
  693. X}
  694. X
  695. X
  696. Xnowork()
  697. X{
  698. X    faterror("Can't open %s",workfilename);
  699. X}
  700. X@
  701. X
  702. X
  703. X4.5.2.1
  704. Xlog
  705. X@Start of Amiga RCS port branch.
  706. X@
  707. Xtext
  708. X@d6 1
  709. Xa6 5
  710. X<<<<<<< rcsmerge.c
  711. X"$Header: /u/softeng/rsbx/rcs/amiga/RCS.cbmvax/rcsmerge.c,v 4.5.1.1 89/08/11 01:42:57 rsbx Exp Locker: rsbx $ Purdue CS";
  712. X=======
  713. X"$Header: /u/softeng/rsbx/rcs/amiga/RCS/rcsmerge.c,v 1.2 89/09/17 13:36:20 rick Exp $ Purdue CS";
  714. X>>>>>>> 1.2
  715. Xa40 11
  716. X<<<<<<< rcsmerge.c
  717. X * Revision 4.5.1.1  89/08/11  01:42:57  rsbx
  718. X * Start of cbmvax RCS source branch.
  719. X=======
  720. X * Revision 1.2  89/09/17  13:36:20  rick
  721. X * Port to AmigaDos done by Rick Schaeffer (ricks@@iscuva.iscs.com)
  722. X * All changes done with conditional compile (#ifdef AMIGA).  This version
  723. X * compiles correctly with Lattice C version 5.02 or later.
  724. X>>>>>>> 1.2
  725. X * 
  726. X<<<<<<< rcsmerge.c
  727. Xa41 3
  728. X * checked in with -k by rsbx at 89.08.10.16.22.33.
  729. X * 
  730. X * Revision 4.5  89/05/01  15:13:16  narten
  731. Xa51 11
  732. X=======
  733. X * Revision 1.4  89/09/10  09:27:46  rick
  734. X * Moved TARGETDIR to rcs:
  735. X * 
  736. X * Revision 1.3  89/09/09  17:35:44  rick
  737. X * Amiga changes
  738. X * 
  739. X * Revision 1.2  88/09/03  15:12:06  rick
  740. X * Port to AmigaDos.  All done with conditional compiles
  741. X * 
  742. X>>>>>>> 1.2
  743. Xa85 6
  744. X#ifdef AMIGA
  745. X#define DTMPFILE1    ",RDFt1XXXXXX"
  746. X#define DTMPFILE2    ",RDFt2XXXXXX"
  747. X#define DTMPFILE3    ",RDFt3XXXXXX"
  748. X#endif
  749. X
  750. Xa163 1
  751. X<<<<<<< rcsmerge.c
  752. Xa178 7
  753. X=======
  754. X#ifdef AMIGA
  755. X                temp1file=mktempfile("t:",DTMPFILE1);
  756. X                temp2file=mktempfile("t:",DTMPFILE2);
  757. X#else
  758. X                temp1file=mktempfile("/tmp/",TMPFILE1);
  759. X>>>>>>> 1.2
  760. Xd180 1
  761. Xa180 1
  762. X#endif
  763. Xa181 1
  764. X<<<<<<< rcsmerge.c
  765. Xa183 5
  766. X=======
  767. X                VOID sprintf(command,"%sco -q -p%s %s >%s\n",
  768. X                        TARGETDIR,rev1,RCSfilename,temp1file);
  769. X                if (system(command)){
  770. X>>>>>>> 1.2
  771. Xa186 1
  772. X<<<<<<< rcsmerge.c
  773. Xa188 5
  774. X=======
  775. X                VOID sprintf(command,"%sco -q -p%s %s >%s\n",
  776. X                         TARGETDIR,rev2,RCSfilename,temp2file);
  777. X                if (system(command)){
  778. X>>>>>>> 1.2
  779. X@
  780. X
  781. X
  782. X4.5.2.2
  783. Xlog
  784. X@Finished the integration of Rick Schaeffer's RCS Amiga port with the RCS
  785. Xsources I have here (and are later than the ones Rick used).
  786. X@
  787. Xtext
  788. X@d6 5
  789. Xa10 1
  790. X"$Header: /u/softeng/rsbx/rcs/amiga/RCS/rcsmerge.c,v 4.5.2.1 89/10/13 19:19:04 rsbx Exp Locker: rsbx $ Purdue CS";
  791. Xd45 1
  792. Xa45 3
  793. X * Revision 4.5.2.1  89/10/13  19:19:04  rsbx
  794. X * Start of Amiga RCS port branch.
  795. X * 
  796. Xd48 6
  797. Xd55 1
  798. Xd70 11
  799. Xd199 1
  800. Xd214 2
  801. Xd220 2
  802. Xa221 1
  803. X                temp1file=mktempfile("/tmp/",TMPFILE1);
  804. Xd225 1
  805. Xd228 5
  806. Xd236 1
  807. Xd239 5
  808. X@
  809. X
  810. X
  811. X4.5.1.1
  812. Xlog
  813. X@Start of cbmvax RCS source branch.
  814. X@
  815. Xtext
  816. X@d6 1
  817. Xa6 1
  818. X"$Header: /u/softeng/rsbx/rcs/rcs.uunet/src/RCS/rcsmerge.c,v 4.5 89/05/01 15:13:16 narten Exp $ Purdue CS";
  819. Xa40 3
  820. X * Revision 4.5  89/05/01  15:13:16  narten
  821. X * checked in with -k by rsbx at 89.08.10.16.22.33.
  822. X * 
  823. X@
  824. SHAR_EOF
  825. echo "extracting rcs/rcs_link"
  826. sed 's/^X//' << \SHAR_EOF > rcs/rcs_link
  827. XRCS.RCSfiles/
  828. SHAR_EOF
  829. echo "extracting readme"
  830. sed 's/^X//' << \SHAR_EOF > readme
  831. XThese 2 disks contain the sources and executable to a port of RCS to the
  832. XAmiga from Unix. The port was done by Raymond S. Brand and Rick Schaeffer.
  833. X
  834. XInstallation:
  835. X    Create a directory for the RCS executables and in your startup-
  836. Xsequence, assign RCS: to that directory. You may also want to add RCS: to
  837. Xyour path. Copy the files from the bin directory on disk 1 to the RCS
  838. Xdirectory. Add 'SetEnv USERNAME xxxx' to your startup-sequence, where xxxx
  839. Xis replaced by what you want RCS to think your user id is. Your user id
  840. Xmay not contain any of the following characters; " ", "$", ",", ".", ":",
  841. X";", "@".
  842. X    Read the documentation in the doc directory of disk 1.
  843. X
  844. XRCS_link:
  845. X    If the file "RCS_link" exists in the current directory, then
  846. Xthe RCS tools  will look in this file for the path name of the RCS
  847. Xdirectory.  So, if your RCS files are in foo:local/src/foobar/RCS and
  848. Xyou are in your local directory of hd6:joker/foobar then the RCS_link
  849. Xfile in your current directory should contain:
  850. X
  851. X    "foo:local/src/foobar/RCS/\n"
  852. X
  853. XThe RCS_link may either an absolute or a relative path but must end with
  854. Xa ":" or a "/" followed by a linefeed. The RCS_link feature is a rather
  855. Xlate addition to the code and therefor has had rather limited testing.
  856. X
  857. XWarning:
  858. X    The business of RCS is the manipulation of source files. We believe
  859. Xthat the software has no serious bugs but you should make plenty of backups
  860. Xof your files (at least) until you are sure this software works for you.
  861. X
  862. XTodo:
  863. X    Port the rcsfreeze and rcsclean scripts to the Amiga. Cleanup the
  864. Xcode sections labeled TODO.
  865. X
  866. XBugs:
  867. X    If you find any, please send a descriptive note Ray and/or Rick at
  868. Xthe addresses below.
  869. X
  870. XRaymond S. Brand        Rick Schaeffer
  871. XCommodore-Amiga Engineering    E. 13611 26th Ave.
  872. X1200 Wilson Drive        Spokane, Wa.   99216
  873. XWest Chester PA 19380        ricks@isc-br.isc-br.com
  874. Xrsbx@cbmvax.commodore.com       ...!uunet!isc-br!ricks
  875. X...!uunet!cbmvax!rsbx
  876. SHAR_EOF
  877. echo "extracting readme.extras"
  878. sed 's/^X//' << \SHAR_EOF > readme.extras
  879. XThere are some stand-alone utilities in this distribution that are
  880. Xuseful.  They must be located in the "RCS:" directory in order for
  881. Xthe RCS programs to find them, but assuming that "RCS:" is in your
  882. Xsearch path, they are available for other purposes.
  883. X
  884. XFirst, there is "diff" and "diff3".  These are ports from GNU and are much
  885. Xfaster and more flexible than anything similar available for the Amiga.
  886. XFor instance, the version of diff provided here supports directory and
  887. Xsub-directory diff listings.  Diff3 is probably of limited use except
  888. Xinside RCS...however, it does use true pipes and, in conjunction with
  889. Xthe source for popen.c (in the "rsbx.lib" directory) may prove useful
  890. Xas a coding example. [Another good popen() example is merge.c in the source
  891. Xdirectory for RCS. rsbx]  At any rate, peruse the README file that is
  892. Xpresent in the "diff" directory for details.
  893. X
  894. XSecond there is "ked".  This is an Amiga version of the famous (infamous?)
  895. XUnix "ed" program.  It is named "ked" here because the name "ed" was
  896. Xalready taken on the Amiga.  It is, as far as I know, completely compatible
  897. Xwith the Unix version of ed...including the ability to read scripts from
  898. Xstdin.  It is used by the "merge" program in RCS to process the piped
  899. Xoutput from diff3 but does work stand-alone.
  900. X
  901. X
  902. X                    Rick
  903. SHAR_EOF
  904. if `test ! -d rsbx.lib`
  905. then
  906.   mkdir rsbx.lib
  907.   echo "mkdir rsbx.lib"
  908. fi
  909. echo "extracting rsbx.lib/rsbx.lib.doc"
  910. sed 's/^X//' << \SHAR_EOF > rsbx.lib/rsbx.lib.doc
  911. X
  912. X
  913. XTABLE OF CONTENTS
  914. X
  915. Xrsbx.lib/ChildStatus()
  916. Xrsbx.lib/CreateFamily()
  917. Xrsbx.lib/EmptyMorgue()
  918. Xrsbx.lib/EscapeAdditions()
  919. Xrsbx.lib/EscapeString()
  920. Xrsbx.lib/LaunchChildl()
  921. Xrsbx.lib/LaunchChildv()
  922. Xrsbx.lib/OrphanChild()
  923. Xrsbx.lib/OrphanChildren()
  924. Xrsbx.lib/pclose()
  925. Xrsbx.lib/popenl()
  926. Xrsbx.lib/popenv()
  927. Xrsbx.lib/WaitChild()
  928. X
  929. X
  930. Xrsbx.lib/ChildStatus()                                   rsbx.lib/ChildStatus()
  931. X
  932. X   NAME
  933. X    ChildStatus -- Check completion status of child process.
  934. X
  935. X   SYNOPSIS
  936. X    completion = ChildStatus(child, status)
  937. X
  938. X    struct ChildNode *ChildStatus(struct ChildNode *, long *);
  939. X
  940. X   FUNCTION
  941. X    Checks if a child process has completed and sets status to the return
  942. X        code from the child process if it has.
  943. X
  944. X   INPUTS
  945. X    child         - Child process identifier returned from LaunchChildX();
  946. X    status        - Pointer to a long to place the return code from the
  947. X                    child process in.
  948. X
  949. X   RESULT
  950. X    completion    - Child process identifier if child is a child process
  951. X                    of this process and has completed. If child is a child
  952. X                    process of this process and has not completed, then
  953. X            completion is 0 and status is set to 0. If child is
  954. X                    not a child procewss of this process, then completion
  955. X                    is 0 and status will be non-zero.
  956. X
  957. X   NOTES
  958. X
  959. X   SEE ALSO
  960. X    CreateFamily(), EmptyMorgue(), LaunchChildl(), LaunchChildv(),
  961. X    OrphanChild(), OrphanChildren(), WaitChild().
  962. X
  963. X   BUGS
  964. X    None known.
  965. X
  966. X
  967. Xrsbx.lib/CreateFamily()                                 rsbx.lib/CreateFamily()
  968. X
  969. X   NAME
  970. X    CreateFamily -- 
  971. X
  972. X   SYNOPSIS
  973. X    success = CreateFamily()
  974. X
  975. X    int CreateFamily( void );
  976. X
  977. X   FUNCTION
  978. X    This function initializes the structures used to keep track of child
  979. X        processes of this process.
  980. X
  981. X   INPUTS
  982. X
  983. X   RESULT
  984. X    success       - Zero if unable to allocate and initialize needed
  985. X                    structures.
  986. X
  987. X   NOTES
  988. X
  989. X   SEE ALSO
  990. X    ChildStatus(), EmptyMorgue(), LaunchChildl(), LaunchChildv(),
  991. X    OrphanChild(), OrphanChildren(), WaitChild().
  992. X
  993. X   BUGS
  994. X    None Known.
  995. X
  996. X
  997. Xrsbx.lib/EmptyMorgue()                                   rsbx.lib/EmptyMorgue()
  998. X
  999. X   NAME
  1000. X    EmptyMorgue -- Process child termination messages.
  1001. X
  1002. X   SYNOPSIS
  1003. X    EmptyMorgue()
  1004. X
  1005. X    void EmptyMorgue( void );
  1006. X
  1007. X   FUNCTION
  1008. X    This function processes any termination messages from child processes
  1009. X        of this process.
  1010. X
  1011. X   INPUTS
  1012. X
  1013. X   RESULT
  1014. X
  1015. X   NOTES
  1016. X
  1017. X   SEE ALSO
  1018. X    ChildStatus(), CreateFamily(), LaunchChildl(), LaunchChildv(),
  1019. X    OrphanChild(), OrphanChildren(), WaitChild().
  1020. X
  1021. X   BUGS
  1022. X    None Known.
  1023. X
  1024. X
  1025. Xrsbx.lib/EscapeAdditions()                           rsbx.lib/EscapeAdditions()
  1026. X
  1027. X   NAME
  1028. X    EscapeAdditions -- Return number of characters to escape an argument.
  1029. X
  1030. X   SYNOPSIS
  1031. X    escapes = EscapeAdditions(argv)
  1032. X
  1033. X    int EscapeAdditions(char *);
  1034. X
  1035. X   FUNCTION
  1036. X    Determines the number of extra characters that are needed to escape
  1037. X        a command argument for AmigaDos command parsing.
  1038. X
  1039. X   INPUTS
  1040. X    argv          - Argument to check.
  1041. X
  1042. X   RESULT
  1043. X    escapes       - The number of characters that need to be added to the
  1044. X                    argument to escape the characters special to AmigaDos.
  1045. X
  1046. X   NOTES
  1047. X    Characters special to AmigaDos are " [0x22], * [0x2a], ESC [0x1b],
  1048. X        LF [0x0a], SP [0x20].
  1049. X
  1050. X   SEE ALSO
  1051. X    EscapeAdditions(), EscapeString().
  1052. X
  1053. X   BUGS
  1054. X    Thinks spaces need an AmigaDos escape character preceeding them.
  1055. X
  1056. X
  1057. Xrsbx.lib/EscapeString()                                 rsbx.lib/EscapeString()
  1058. X
  1059. X   NAME
  1060. X    EscapeString -- Copy argument to buffer escaping as needed.
  1061. X
  1062. X   SYNOPSIS
  1063. X    dest = EscapeString(buffer, argv)
  1064. X
  1065. X    char *EscapeAdditions(char *, char *);
  1066. X
  1067. X   FUNCTION
  1068. X    Copies a string containing a single argument to a buffer, escaping
  1069. X        characters special to AmigaDos.
  1070. X
  1071. X   INPUTS
  1072. X    buffer        - Buffer for escaped argument string.
  1073. X    argv          - Argument string to escape.
  1074. X
  1075. X   RESULT
  1076. X    dest          - The same as buffer.
  1077. X
  1078. X   NOTES
  1079. X    Characters special to AmigaDos are " [0x22], * [0x2a], ESC [0x1b],
  1080. X        LF [0x0a], SP [0x20].
  1081. X
  1082. X   SEE ALSO
  1083. X    EscapeAdditions(), EscapeString().
  1084. X
  1085. X   BUGS
  1086. X    Thinks spaces need an AmigaDos escape character preceeding them.
  1087. X
  1088. X
  1089. Xrsbx.lib/LaunchChildl()                                 rsbx.lib/LaunchChildl()
  1090. X
  1091. X   NAME
  1092. X    LaunchChildl -- Launch a child process with argument list.
  1093. X
  1094. X   SYNOPSIS
  1095. X    cpid = LaunchChildl(envp, name, arg0, ..., argn, NULL)
  1096. X
  1097. X    struct ChildNode *LaunchChildl(struct LAUNCHENV *, char *, char *, ...);
  1098. X
  1099. X   FUNCTION
  1100. X    This function behaves like a combination of the Unix 'fork' and 'execl'
  1101. X        functions. That is, a new process is created, as with 'fork', and
  1102. X        executes a load module, as with 'execl'.
  1103. X
  1104. X   INPUTS
  1105. X    envp          - Pointer to a LAUNCHENV structure that has been
  1106. X                    initialized with apropriate values prior to calling
  1107. X                    this function. The LAUNCHENV structure only need exist
  1108. X                    during the execution of this function.
  1109. X    name          - Name of the file to execute.
  1110. X    arg0          - Same as name, by Unix convention.
  1111. X       ...           - Other command line arguments needed by the file to be
  1112. X                    executed.
  1113. X    NULL          - Zero.
  1114. X
  1115. X   RESULT
  1116. X    cpid          - Pointer to a ChildNode structure, used to identify the
  1117. X                    child process.
  1118. X
  1119. X   NOTES
  1120. X    struct LAUNCHENV
  1121. X            {
  1122. X            long priority;   priority for child process
  1123. X            ULONG stack;     stack size for child process.
  1124. X                              If zero, stack size of calling
  1125. X                              process will be used.
  1126. X            BPTR std_in;     AmigaDos filehandle for child's
  1127. X                              Input() stream. If zero, Input()
  1128. X                              stream of calling process used.
  1129. X            BPTR std_out;    AmigaDos filehandle for child's
  1130. X                              Output() stream. If zero, Output()
  1131. X                              stream of calling process used.
  1132. X            BPTR console;    console window handler port for
  1133. X                              child.
  1134. X            BPTR le_fh1;     AmigaDos filehandle for child to
  1135. X                              close at exit.
  1136. X            BPTR le_fh2;     AmigaDos filehandle for child to
  1137. X                              close at exit.
  1138. X            };
  1139. X
  1140. X   SEE ALSO
  1141. X    ChildStatus(), CreateFamily(), EmptyMorgue(), LaunchChildv(),
  1142. X    OrphanChild(), OrphanChildren(), WaitChild().
  1143. X
  1144. X   BUGS
  1145. X    This function does not create a complete CLI enviroment for the child
  1146. X        process. Use of this function with a command that expects a BCPL
  1147. X        environment will crash the system.
  1148. X
  1149. X
  1150. Xrsbx.lib/LaunchChildv()                                 rsbx.lib/LaunchChildv()
  1151. X
  1152. X   NAME
  1153. X    LaunchChildv -- Launch a child process with argument list.
  1154. X
  1155. X   SYNOPSIS
  1156. X    cpid = LaunchChildv(envp, name, argv)
  1157. X
  1158. X    struct ChildNode *LaunchChildv(struct LAUNCHENV *, char **);
  1159. X
  1160. X   FUNCTION
  1161. X    This function behaves like a combination of the Unix 'fork' and 'execv'
  1162. X        functions. That is, a new process is created, as with 'fork', and
  1163. X        executes a load module, as with 'execv'.
  1164. X
  1165. X   INPUTS
  1166. X    envp          - Pointer to a LAUNCHENV structure that has been
  1167. X                    initialized with apropriate values prior to calling
  1168. X                    this function. The LAUNCHENV structure only need exist
  1169. X                    during the execution of this function.
  1170. X    name          - Name of the file to execute.
  1171. X    argv          - An array of pointers to the argument strings for the
  1172. X                    command. The last argument pointer must be followed
  1173. X                    by a 0 pointer. The first pointer, argv[0], is the
  1174. X                    same as name, by unix convention.
  1175. X
  1176. X   RESULT
  1177. X    cpid          - Pointer to a ChildNode structure, used to identify the
  1178. X                    child process.
  1179. X
  1180. X   NOTES
  1181. X    struct LAUNCHENV
  1182. X            {
  1183. X            long priority;   priority for child process
  1184. X            ULONG stack;     stack size for child process.
  1185. X                              If zero, stack size of calling
  1186. X                              process will be used.
  1187. X            BPTR std_in;     AmigaDos filehandle for child's
  1188. X                              Input() stream. If zero, Input()
  1189. X                              stream of calling process used.
  1190. X            BPTR std_out;    AmigaDos filehandle for child's
  1191. X                              Output() stream. If zero, Output()
  1192. X                              stream of calling process used.
  1193. X            BPTR console;    console window handler port for
  1194. X                              child.
  1195. X            BPTR le_fh1;     AmigaDos filehandle for child to
  1196. X                              close at exit.
  1197. X            BPTR le_fh2;     AmigaDos filehandle for child to
  1198. X                              close at exit.
  1199. X            };
  1200. X
  1201. X   SEE ALSO
  1202. X    ChildStatus(), CreateFamily(), EmptyMorgue(), LaunchChildl(),
  1203. X    OrphanChild(), OrphanChildren(), WaitChild().
  1204. X
  1205. X   BUGS
  1206. X    This function does not create a complete CLI enviroment for the child
  1207. X        process. Use of this function with a command that expects a BCPL
  1208. X        environment will crash the system.
  1209. X
  1210. X
  1211. Xrsbx.lib/OrphanChild()                                   rsbx.lib/OrphanChild()
  1212. X
  1213. X   NAME
  1214. X    OrphanChild -- Dis-associate a child process from this process.
  1215. X
  1216. X   SYNOPSIS
  1217. X    success = OrphanChild(child)
  1218. X
  1219. X    int OrphanChild(struct ChildNode * );
  1220. X
  1221. X   FUNCTION
  1222. X    This function will dis-associate a child process from this process and
  1223. X        free the structures used to track the child process.
  1224. X
  1225. X   INPUTS
  1226. X    child         - Child identifier returned by LaunchChildl() or by
  1227. X                    LaunchChildv().
  1228. X
  1229. X   RESULT
  1230. X    success       - Zero if invalid child identifier.
  1231. X
  1232. X   NOTES
  1233. X
  1234. X   SEE ALSO
  1235. X    ChildStatus(), CreateFamily(), EmptyMorgue(), LaunchChildl(),
  1236. X    LaunchChildv(), OrphanChildren(), WaitChild().
  1237. X
  1238. X   BUGS
  1239. X    None Known.
  1240. X
  1241. X
  1242. Xrsbx.lib/OrphanChildren()                             rsbx.lib/OrphanChildren()
  1243. X
  1244. X   NAME
  1245. X    OrphanChildren -- Orphan all child processes of this process.
  1246. X
  1247. X   SYNOPSIS
  1248. X    OrphanChildren()
  1249. X
  1250. X    void OrphanChildren( void );
  1251. X
  1252. X   FUNCTION
  1253. X    This function orphans all child processes of this process and frees
  1254. X        the memory used to keep track of the children.
  1255. X
  1256. X   INPUTS
  1257. X
  1258. X   RESULT
  1259. X
  1260. X   NOTES
  1261. X
  1262. X   SEE ALSO
  1263. X    ChildStatus(), CreateFamily(), EmptyMorgue(), LaunchChildl(),
  1264. X    LaunchChildv(), OrphanChild(), WaitChild().
  1265. X
  1266. X   BUGS
  1267. X    None Known.
  1268. X
  1269. X
  1270. Xrsbx.lib/pclose()                                             rsbx.lib/pclose()
  1271. X
  1272. X   NAME
  1273. X    pclose -- Closes pipe opened by popenl() or by popenv().
  1274. X
  1275. X   SYNOPSIS
  1276. X    status = pclose(pipe)
  1277. X
  1278. X    int pclose(FILE *);
  1279. X
  1280. X   FUNCTION
  1281. X    Waits for the command associated with the pipe to exit, closes the
  1282. X        stream, and returns the return code from the command.
  1283. X
  1284. X   INPUTS
  1285. X    pipe          - Stream pointer returned by a call to popenl() or to
  1286. X                    popenv().
  1287. X
  1288. X   RESULT
  1289. X    status        - The return code from the command executed, or -1 if
  1290. X                    pipe wasn't opened by popenl() or by popenv().
  1291. X
  1292. X   NOTES
  1293. X
  1294. X   SEE ALSO
  1295. X    popenl(), popenv().
  1296. X
  1297. X   BUGS
  1298. X    None known.
  1299. X
  1300. X
  1301. Xrsbx.lib/popenl()                                             rsbx.lib/popenl()
  1302. X
  1303. X   NAME
  1304. X    popenl -- Initiate I/O to or from a command.
  1305. X
  1306. X   SYNOPSIS
  1307. X    pipe = popenl(arg0, ..., argn, NULL, mode)
  1308. X
  1309. X    FILE *popenl(char *, char *, ...);
  1310. X
  1311. X   FUNCTION
  1312. X    Creates a stream between the calling process and the stdin or stdout
  1313. X        streams of the command it executes. Mode should be "r" to read
  1314. X        the stdout stream of the command, or "w" to write to the stdin
  1315. X        stream of the command. 
  1316. X
  1317. X   INPUTS
  1318. X    arg0          - Name of file to execute.
  1319. X       ...           - Other command line arguments needed by the file to be
  1320. X                    executed.
  1321. X    NULL          - Zero.
  1322. X    mode          _ I/O mode string.
  1323. X
  1324. X   RESULT
  1325. X    pipe          - File pointer to use to read or write to the command
  1326. X                    with.
  1327. X
  1328. X   NOTES
  1329. X    A stream opened by popenl() should be closed by pclose().
  1330. X
  1331. X   SEE ALSO
  1332. X    popenv(), pclose().
  1333. X
  1334. X   BUGS
  1335. X    This function does not create a complete CLI enviroment for the child
  1336. X        process. Use of this function with a command that expects a BCPL
  1337. X        environment will crash the system. The Unix function 'popen' takes
  1338. X        as arguments a command string which it passes to the shell, and a
  1339. X        mode string.
  1340. X
  1341. X
  1342. Xrsbx.lib/popenv()                                             rsbx.lib/popenv()
  1343. X
  1344. X   NAME
  1345. X    popenv -- Initiate I/O to or from a command.
  1346. X
  1347. X   SYNOPSIS
  1348. X    pipe = popenv(argv, mode)
  1349. X
  1350. X    FILE *popenv(char **, char *);
  1351. X
  1352. X   FUNCTION
  1353. X    Creates a stream between the calling process and the stdin or stdout
  1354. X        streams of the command it executes. Mode should be "r" to read
  1355. X        the stdout stream of the command, or "w" to write to the stdin
  1356. X        stream of the command. 
  1357. X
  1358. X   INPUTS
  1359. X    argv          - An array of pointer to the argument strings for the
  1360. X                    command. The last pointer must be followed by a 0
  1361. X                    pointer. The first pointer, argv[0], is the name of
  1362. X                    file to execute.
  1363. X    mode          _ I/O mode string.
  1364. X
  1365. X   RESULT
  1366. X    pipe          - File pointer to use to read or write to the command
  1367. X                    with.
  1368. X
  1369. X   NOTES
  1370. X    A stream opened by popenv() should be closed by pclose().
  1371. X
  1372. X   SEE ALSO
  1373. X    popenl(), pclose().
  1374. X
  1375. X   BUGS
  1376. X    This function does not create a complete CLI enviroment for the child
  1377. X        process. Use of this function with a command that expects a BCPL
  1378. X        environment will crash the system. The Unix function 'popen' takes
  1379. X        as arguments a command string which it passes to the shell, and a
  1380. X        mode string.
  1381. X
  1382. X
  1383. Xrsbx.lib/WaitChild()                                       rsbx.lib/WaitChild()
  1384. X
  1385. X   NAME
  1386. X    WaitChild -- Wait for child process to terminate.
  1387. X
  1388. X   SYNOPSIS
  1389. X    term = WaitChild(child, status)
  1390. X
  1391. X    struct ChildNode *WaitChild(struct ChildNode *, long * );
  1392. X
  1393. X   FUNCTION
  1394. X    This function waits for a child process to terminate, and places the
  1395. X        child's return val in the long pointed to by status. If the child
  1396. X        identifier provided doen't belong to a child of this process, then
  1397. X        0 is returned. If the child identifier is zero, returns the child
  1398. X        identifier of a child that has terminated and sets the long status
  1399. X        points to to its return val. If the child identifier is zero and
  1400. X        no child has yet terminated, wait for any child to terminate and
  1401. X        return its identifier and set the long status points to to its
  1402. X        return val. If the child identifier is zero and there are no child
  1403. X        processes of this process, return zero.
  1404. X
  1405. X   INPUTS
  1406. X    child         - Child identifier as returned by LaunchChildl() or by
  1407. X                    LaunchChildv().
  1408. X    status        - Pointer to a long to store the return val of the child
  1409. X                    in.
  1410. X
  1411. X   RESULT
  1412. X    term          - Child identifier of the child process whos return val
  1413. X                    was stored in the long pointed to by status, or zero
  1414. X                    if there was an error.
  1415. X
  1416. X   NOTES
  1417. X
  1418. X   SEE ALSO
  1419. X    ChildStatus(), CreateFamily(), EmptyMorgue(), LaunchChildl(),
  1420. X    LaunchChildv(), OrphanChild(), OrphanChildren().
  1421. X
  1422. X   BUGS
  1423. X    None Known.
  1424. X
  1425. X
  1426. SHAR_EOF
  1427. echo "extracting rsbx.lib/xc.asm"
  1428. sed 's/^X//' << \SHAR_EOF > rsbx.lib/xc.asm
  1429. X*
  1430. X* This is a copy of c.a, distributed with the Lattice 5.04 compiler, that has
  1431. X*    been hacked to support my LaunchChild calls. There is no WorkBench
  1432. X*    support in this startup.
  1433. X*
  1434. X*                    Ray
  1435. X*
  1436. X*
  1437. X* C initial startup procedure under AmigaDOS
  1438. X* 
  1439. X* Use the following command line to make c.o
  1440. X* asm -u -iINCLUDE: c.a
  1441. X*
  1442. X* Use the following command line to make cres.o
  1443. X* asm -u -dRESIDENT -iINCLUDE: -ocres.o c.a
  1444. X*
  1445. X    INCLUDE    "exec/types.i"
  1446. X    INCLUDE    "exec/alerts.i"
  1447. X    INCLUDE    "exec/nodes.i"
  1448. X    INCLUDE    "exec/lists.i"
  1449. X    INCLUDE    "exec/ports.i"
  1450. X    INCLUDE    "exec/libraries.i"
  1451. X    INCLUDE    "exec/tasks.i"
  1452. X    INCLUDE    "exec/memory.i"
  1453. X    INCLUDE    "exec/execbase.i"
  1454. X    INCLUDE    "libraries/dos.i"
  1455. X    INCLUDE    "libraries/dosextens.i"
  1456. X    INCLUDE    "exec/funcdef.i"
  1457. X    INCLUDE    "exec/exec_lib.i"
  1458. X    INCLUDE    "libraries/dos_lib.i"
  1459. X
  1460. XMEMFLAGS    EQU    MEMF_CLEAR+MEMF_PUBLIC
  1461. XAbsExecBase    EQU    4
  1462. X
  1463. X; some usefull macros:
  1464. X
  1465. Xcallsys macro
  1466. X    CALLLIB _LVO\1
  1467. X    endm
  1468. X    
  1469. X    xdef    _XCEXIT        * exit(code) is standard way to leave C.
  1470. X    xdef    _@XCEXIT
  1471. X    
  1472. X    xref    _LinkerDB    * linker defined base value
  1473. X    xref    __BSSBAS    * linker defined base of BSS
  1474. X    xref    __BSSLEN    * linker defined length of BSS
  1475. X    IFD    RESIDENT
  1476. X    xref    _RESLEN
  1477. X    xref    _RESBASE
  1478. X    xref    _NEWDATAL
  1479. X    xref    __stack
  1480. X    ENDC
  1481. X    
  1482. X*    library references
  1483. X
  1484. X    section text,code
  1485. X
  1486. X    xref    __xmain            * Name of C program to start with.
  1487. X    xref    _MemCleanup        * Free all allocated memory
  1488. X    xref    ___fpinit        * initialize floating point
  1489. X    xref    ___fpterm        * terminate floating point
  1490. X    
  1491. Xstart:
  1492. X    movem.l d1-d6/a0-a6,-(a7)
  1493. X
  1494. X    move.l    a0,a2            * save command pointer
  1495. X    move.l    d0,d2            * and command length
  1496. X    lea    _LinkerDB,a4        * load base register
  1497. X    move.l    AbsExecBase.W,a6
  1498. X
  1499. X*------ are we running as a son of Workbench?
  1500. X    move.l    ThisTask(a6),A3
  1501. X    tst.l    pr_CLI(A3)
  1502. X    bne.s    fromCLI
  1503. X    
  1504. X*=======================================================================
  1505. X*====== Workbench Startup Code =========================================
  1506. X*=======================================================================
  1507. X
  1508. XfromWorkbench:
  1509. X
  1510. X    lea    pr_MsgPort(A3),a0    * our process base
  1511. X    callsys WaitPort
  1512. X    lea    pr_MsgPort(A3),a0    * our process base
  1513. X    callsys GetMsg
  1514. X    move.l    d0,a2
  1515. X
  1516. X*$* should put recoverable alert here
  1517. X
  1518. X*------    return the startup message to our parent
  1519. X*    we forbid so workbench can't UnLoadSeg() us
  1520. X*    before we are done:
  1521. X    callsys    Forbid
  1522. X    move.l    a2,a1
  1523. X    callsys    ReplyMsg
  1524. X
  1525. X    moveq.l    #-1,D0
  1526. X    
  1527. X    movem.l (a7)+,d1-d6/a0-a6
  1528. X    rts
  1529. X    
  1530. X*=======================================================================
  1531. X*====== CLI Startup Code ===============================================
  1532. X*=======================================================================
  1533. X
  1534. XfromCLI:
  1535. X    IFND    RESIDENT
  1536. X        lea    __BSSBAS,a3        * get base of BSS
  1537. X        moveq    #0,d1
  1538. X        move.l    #__BSSLEN,d0        * get length of BSS in longwords
  1539. X        bra.s    clr_lp            * and clear for length given
  1540. Xclr_bss        move.l    d1,(a3)+
  1541. Xclr_lp        dbf    d0,clr_bss
  1542. X        move.l    a7,__StackPtr(A4)    * Save stack ptr
  1543. X        move.l    a6,_SysBase(A4)
  1544. X    ENDC
  1545. X    
  1546. X
  1547. X    IFD    RESIDENT
  1548. X        movem.l    d2,-(a7)
  1549. X        movem.l a0-a2,-(a7)
  1550. X
  1551. X*------        get the size of the stack, if CLI use cli_DefaultStack
  1552. X
  1553. X        move.l    ThisTask(a6),A3
  1554. X        move.l    pr_CLI(A3),d1
  1555. X        lsl.l    #2,d1
  1556. X        move.l    d1,a0
  1557. X        move.l    cli_DefaultStack(a0),d1
  1558. X        lsl.l    #2,d1            * # longwords -> # bytes
  1559. X
  1560. Xdostack:
  1561. X        moveq    #0,d2            * use d2 as flag for newstack or not
  1562. X        move.l    #RESLEN,d0
  1563. X        cmp.l    __stack(a4),d1        * This a4 is in the original 
  1564. X                        * set of data
  1565. X        bcc.s    nochange    
  1566. X        move.l    __stack(a4),d1
  1567. X        add.l    d1,d0            * increase size of mem for new stack
  1568. X        moveq    #1,d2            * set flag
  1569. X        
  1570. Xnochange:
  1571. X        move.l    d1,a3            * save stacksize to set up stack checking
  1572. X        move.l    #MEMFLAGS,d1
  1573. X        callsys AllocMem
  1574. X        tst.l    d0
  1575. X        bne.s    ok1
  1576. X        movem.l    (a7)+,d2/a0-a2
  1577. X*$* ACK!!!
  1578. X*$*        rts
  1579. X*$* ACK!!!
  1580. X
  1581. Xok1:        move.l    d0,a0
  1582. X        move.l    d0,a2
  1583. X
  1584. X    ;a2 now has difference
  1585. X        move.l    d0,a1
  1586. X        move.l    #NEWDATAL,d0
  1587. X        sub.l    #RESBASE,a4
  1588. X    ;copy data over
  1589. Xcpy:        move.l    (a4)+,(a0)+
  1590. X        subq.l    #1,d0
  1591. X        bne.s    cpy
  1592. X    ;a4 now points at number of relocs
  1593. X        move.l    (a4)+,d0
  1594. Xreloc:        beq.s    nreloc
  1595. X        move.l    a1,a0
  1596. X        add.l    (a4)+,a0        * a0 now has add of reloc
  1597. X        add.l    (a0),a2
  1598. X        move.l    a2,(a0) 
  1599. X        move.l    a1,a2            * restore offset
  1600. X        subq.l    #1,d0
  1601. X        bra.s    reloc
  1602. X
  1603. Xnreloc:        move.l    a1,a4            * set up new base register
  1604. X        add.l    #RESBASE,a4
  1605. X
  1606. X        move.l    #RESLEN,realdatasize(a4)
  1607. X        movem.l (a7)+,a0-a2
  1608. X
  1609. X        move.l    a6,_SysBase(A4)
  1610. X        tst.b    d2
  1611. X        movem.l    (a7)+,d2        * restore d2 
  1612. X        movem.l a7,__StackPtr(A4)    * Save stack ptr (movem doesn't
  1613. X                        * change flags
  1614. X        beq.s    nochg2
  1615. X
  1616. X*------        set up new stack
  1617. X        move.l    a4,d0
  1618. X        sub.l    #RESBASE,d0
  1619. X        add.l    #RESLEN,d0
  1620. X        add.l    __stack(a4),d0        * here a4 will be pointing at the
  1621. X                        * new data, but _stack will be the
  1622. X                        * same if all goes well
  1623. X
  1624. X        sub.l    #128,d0            * 128 down for good measure
  1625. X        move.l    d0,a7
  1626. X        move.l    __stack(a4),d0
  1627. X        move.l    d0,4(a7)        * fill in size of new stack    
  1628. X        add.l    d0,_realdatasize(a4)     * need to know how much to free later
  1629. X
  1630. Xnochg2:
  1631. X*------        Set _base for stack checking
  1632. X        move.l    a7,d1
  1633. X        sub.l    a3,d1            * get top of stack
  1634. X        add.l    #128,D1            * allow for parms overflow
  1635. X        move.l    D1,__base(A4)        * save for stack checking
  1636. X
  1637. X    ENDC
  1638. X
  1639. Xclrwb:
  1640. X    clr.l    _WBenchMsg(A4)
  1641. X
  1642. X*-----    clear any pending signals
  1643. X    moveq    #0,d0
  1644. X    move.l    #$00003000,d1
  1645. X    callsys    SetSignal
  1646. X    
  1647. X
  1648. X*------ attempt to open DOS library:
  1649. X    lea    DOSName(PC),A1
  1650. X    moveq.l #0,D0
  1651. X    callsys OpenLibrary
  1652. X    move.l    D0,_DOSBase(A4)
  1653. X    bne.s    ok2
  1654. X    moveq.l #100,d0
  1655. X    bra.w    exit2
  1656. X
  1657. Xok2:
  1658. X*=======================================================================
  1659. X*
  1660. X* Entry: D2 = command length
  1661. X*    A2 = Command pointer
  1662. X
  1663. X    ifnd    RESIDENT        * we need to set _base if not resident
  1664. X        move.l    a7,D0        * get top of stack
  1665. X        sub.l    4(a7),D0    * compute bottom 
  1666. X        add.l    #128,D0        * allow for parms overflow
  1667. X        move.l    D0,__base(A4)    * save for stack checking
  1668. X    endc
  1669. X    
  1670. X*------ find command name:
  1671. X    move.l    ThisTask(a6),A3
  1672. X    move.l    pr_CLI(a3),a0
  1673. X    add.l    a0,a0        * bcpl pointer conversion
  1674. X    add.l    a0,a0
  1675. X    move.l    cli_CommandName(a0),a1
  1676. X    add.l    a1,a1        * bcpl pointer conversion
  1677. X    add.l    a1,a1
  1678. X
  1679. X*------ collect parameters:
  1680. X    move.b    (a1)+,d0
  1681. X    move.l    a1,__ProgramName(A4)
  1682. X
  1683. X
  1684. X    move.l    d2,-(A7)        * push command line length
  1685. X    move.l    a2,-(A7)        * push command line address
  1686. X
  1687. X*=============================================
  1688. X*------ common code --------
  1689. X*=============================================
  1690. X
  1691. Xmain    jsr    ___fpinit(PC)        * Initialize floating point
  1692. X    jsr    __xmain(PC)        * call C entrypoint
  1693. X    moveq.l    #0,d0            * set successful status
  1694. X    bra.s    exit2
  1695. X*
  1696. X
  1697. X_XCEXIT:
  1698. X    move.l    4(SP),d0        * extract return code
  1699. X_@XCEXIT:
  1700. Xexit2:
  1701. X    move.l    d0,-(a7)
  1702. X    move.l    __ONEXIT(A4),d0        * exit trap function?
  1703. X    beq.s     exit3
  1704. X    move.l    d0,a0
  1705. X    jsr    (a0)
  1706. Xexit3    move.l    __Children(a4),d0    * if we have any children
  1707. X    beq.s    exit4            *    orphan them
  1708. X    move.l    d0,a0
  1709. X    move.l    (a0),a0
  1710. X    jsr    (a0)
  1711. Xexit4    jsr    _MemCleanup(PC)        * cleanup leftover memory alloc.
  1712. X    move.l    AbsExecBase.W,a6
  1713. X    move.l    _DOSBase(A4),a1
  1714. X    callsys CloseLibrary        * close Dos library
  1715. X
  1716. X    jsr    ___fpterm(PC)        * clean up any floating point
  1717. X
  1718. X*------ this rts sends us back to DOS:
  1719. XexitToDOS:
  1720. X    IFD    RESIDENT
  1721. X        move.l    realdatasize(a4),d0
  1722. X        move.l    a4,a1
  1723. X        sub.l    #RESBASE,a1
  1724. X        move.l    AbsExecBase.W,a6
  1725. X        move.l    (A7)+,d6
  1726. X        movea.l    __StackPtr(a4),a5
  1727. X        callsys    FreeMem
  1728. X        move.l    d6,d0
  1729. X        movea.l    a5,sp
  1730. X    ELSE
  1731. X        move.l    (A7)+,D0
  1732. X        movea.l    __StackPtr(a4),SP    * restore stack ptr
  1733. X    ENDC
  1734. X    
  1735. X    movem.l (a7)+,d1-d6/a0-a6
  1736. X    rts
  1737. X
  1738. X
  1739. XDOSName     dc.b    'dos.library',0
  1740. X
  1741. X    section __MERGED,BSS
  1742. X*
  1743. X    xref    _DOSBase
  1744. X
  1745. X    xdef    _NULL,_SysBase,_WBenchMsg
  1746. X    xdef    _curdir,__mbase,__mnext,__msize,__tsize
  1747. X    xdef    __oserr,__OSERR,__FPERR,__SIGFPE,__ONERR,__ONEXIT,__ONBREAK
  1748. X    xdef    __SIGINT
  1749. X    xdef    __ProgramName,__StackPtr,__base
  1750. X    xdef    __Children
  1751. X
  1752. X*
  1753. X    ifd    RESIDENT
  1754. Xrealdatasize    ds.l    1    * size of memory allocated for data +
  1755. X                * possible stack
  1756. X    endc
  1757. X    
  1758. X_NULL        ds.l    1    *
  1759. X__base        ds.l    1    * base of stack
  1760. X__mbase        ds.l    1    * base of memory pool
  1761. X__mnext        ds.l    1    * next available memory location
  1762. X__msize        ds.l    1    * size of memory pool
  1763. X__tsize        ds.l    1    * total size?
  1764. X__oserr        equ    *
  1765. X__OSERR        ds.l    1
  1766. X__FPERR        ds.l    1
  1767. X__SIGFPE    ds.l    1
  1768. X__SIGINT    ds.l    1
  1769. X__ONERR        ds.l    1
  1770. X__ONEXIT    ds.l    1
  1771. X__ONBREAK    ds.l    1
  1772. X_curdir         ds.l    1
  1773. X_SysBase    ds.l    1
  1774. X_WBenchMsg    ds.l    1
  1775. X__StackPtr    ds.l    1
  1776. Xstdin        ds.l    1
  1777. X__ProgramName    ds.l    1
  1778. X__Children    ds.l    1
  1779. X        END
  1780. SHAR_EOF
  1781. echo "extracting rsbx.lib/emptymorgue.c"
  1782. sed 's/^X//' << \SHAR_EOF > rsbx.lib/emptymorgue.c
  1783. X/****** rsbx.lib/EmptyMorgue() ***********************************************
  1784. X*
  1785. X*   NAME
  1786. X*    EmptyMorgue -- Process child termination messages.
  1787. X*
  1788. X*   SYNOPSIS
  1789. X*    EmptyMorgue()
  1790. X*
  1791. X*    void EmptyMorgue( void );
  1792. X*
  1793. X*   FUNCTION
  1794. X*    This function processes any termination messages from child processes
  1795. X*        of this process.
  1796. X*
  1797. X*   INPUTS
  1798. X*
  1799. X*   RESULT
  1800. X*
  1801. X*   NOTES
  1802. X*
  1803. X*   SEE ALSO
  1804. X*    ChildStatus(), CreateFamily(), LaunchChildl(), LaunchChildv(),
  1805. X*    OrphanChild(), OrphanChildren(), WaitChild().
  1806. X*
  1807. X*   BUGS
  1808. X*    None Known.
  1809. X*
  1810. X******************************************************************************
  1811. X*
  1812. X*/
  1813. X
  1814. X#include <rsbx/childtasking.h>
  1815. X
  1816. Xvoid EmptyMorgue( void )
  1817. X    {
  1818. X    struct DeathNotice *msg;
  1819. X    struct ChildNode *node;
  1820. X
  1821. X    while (msg = (struct DeathNotice *)GetMsg(_Children->Morgue))
  1822. X        {
  1823. X        for (node = (struct ChildNode *)_Children->ChildList.mlh_Head;
  1824. X            node->node.mln_Succ;
  1825. X            node = (struct ChildNode *)node->node.mln_Succ)
  1826. X            {
  1827. X            if (&node->notice == msg)
  1828. X                {
  1829. X                msg->noticeptr = NULL;
  1830. X                break;
  1831. X                }
  1832. X            }
  1833. X
  1834. X        if (!node->node.mln_Succ)
  1835. X            {
  1836. X            ReplyMsg((struct Message *)msg);
  1837. X            }
  1838. X        }
  1839. X    }
  1840. SHAR_EOF
  1841. echo "extracting rsbx.lib/waitchild.c"
  1842. sed 's/^X//' << \SHAR_EOF > rsbx.lib/waitchild.c
  1843. X/****** rsbx.lib/WaitChild() *************************************************
  1844. X*
  1845. X*   NAME
  1846. X*    WaitChild -- Wait for child process to terminate.
  1847. X*
  1848. X*   SYNOPSIS
  1849. X*    term = WaitChild(child, status)
  1850. X*
  1851. X*    struct ChildNode *WaitChild(struct ChildNode *, long * );
  1852. X*
  1853. X*   FUNCTION
  1854. X*    This function waits for a child process to terminate, and places the
  1855. X*        child's return val in the long pointed to by status. If the child
  1856. X*        identifier provided doen't belong to a child of this process, then
  1857. X*        0 is returned. If the child identifier is zero, returns the child
  1858. X*        identifier of a child that has terminated and sets the long status
  1859. X*        points to to its return val. If the child identifier is zero and
  1860. X*        no child has yet terminated, wait for any child to terminate and
  1861. X*        return its identifier and set the long status points to to its
  1862. X*        return val. If the child identifier is zero and there are no child
  1863. X*        processes of this process, return zero.
  1864. X*
  1865. X*   INPUTS
  1866. X*    child         - Child identifier as returned by LaunchChildl() or by
  1867. X*                    LaunchChildv().
  1868. X*    status        - Pointer to a long to store the return val of the child
  1869. X*                    in.
  1870. X*
  1871. X*   RESULT
  1872. X*    term          - Child identifier of the child process whos return val
  1873. X*                    was stored in the long pointed to by status, or zero
  1874. X*                    if there was an error.
  1875. X*
  1876. X*   NOTES
  1877. X*
  1878. X*   SEE ALSO
  1879. X*    ChildStatus(), CreateFamily(), EmptyMorgue(), LaunchChildl(),
  1880. X*    LaunchChildv(), OrphanChild(), OrphanChildren().
  1881. X*
  1882. X*   BUGS
  1883. X*    None Known.
  1884. X*
  1885. X******************************************************************************
  1886. X*
  1887. X*/
  1888. X
  1889. X#include <proto/exec.h>
  1890. X#include <rsbx/ChildTasking.h>
  1891. X
  1892. X
  1893. Xstruct ChildNode *WaitChild(struct ChildNode *child, long *status)
  1894. X    {
  1895. X    struct ChildNode *node;
  1896. X
  1897. X    while (1)
  1898. X        {
  1899. X        EmptyMorgue();
  1900. X
  1901. X        if (child)
  1902. X            {
  1903. X            for (node = (struct ChildNode *)_Children->ChildList.mlh_Head;
  1904. X                node->node.mln_Succ;
  1905. X                node = (struct ChildNode *)node->node.mln_Succ)
  1906. X                {
  1907. X                if (node == child)
  1908. X                    {
  1909. X                    if (!child->notice.noticeptr)
  1910. X                        {
  1911. X                        *status = child->notice.ret;
  1912. X                        return child;
  1913. X                        }
  1914. X                    break;
  1915. X                    }
  1916. X                }
  1917. X            if (!node->node.mln_Succ)
  1918. X                {
  1919. X                return 0;
  1920. X                }
  1921. X            }
  1922. X        else
  1923. X            {
  1924. X            for (node = (struct ChildNode *)_Children->ChildList.mlh_Head;
  1925. X                node->node.mln_Succ;
  1926. X                node = (struct ChildNode *)node->node.mln_Succ)
  1927. X                {
  1928. X                if (!node->notice.noticeptr)
  1929. X                    {
  1930. X                    *status = node->notice.ret;
  1931. X                    return node;
  1932. X                    }
  1933. X                }
  1934. X
  1935. X            }
  1936. X
  1937. X        WaitPort(_Children->Morgue);
  1938. X        }
  1939. X    }
  1940. SHAR_EOF
  1941. echo "extracting rsbx.lib/childstatus.c"
  1942. sed 's/^X//' << \SHAR_EOF > rsbx.lib/childstatus.c
  1943. X/****** rsbx.lib/ChildStatus() ***********************************************
  1944. X*
  1945. X*   NAME
  1946. X*    ChildStatus -- Check completion status of child process.
  1947. X*
  1948. X*   SYNOPSIS
  1949. X*    completion = ChildStatus(child, status)
  1950. X*
  1951. X*    struct ChildNode *ChildStatus(struct ChildNode *, long *);
  1952. X*
  1953. X*   FUNCTION
  1954. X*    Checks if a child process has completed and sets status to the return
  1955. X*        code from the child process if it has.
  1956. X*
  1957. X*   INPUTS
  1958. X*    child         - Child process identifier returned from LaunchChildX();
  1959. X*    status        - Pointer to a long to place the return code from the
  1960. X*                    child process in.
  1961. X*
  1962. X*   RESULT
  1963. X*    completion    - Child process identifier if child is a child process
  1964. X*                    of this process and has completed. If child is a child
  1965. X*                    process of this process and has not completed, then
  1966. X*            completion is 0 and status is set to 0. If child is
  1967. X*                    not a child procewss of this process, then completion
  1968. X*                    is 0 and status will be non-zero.
  1969. X*
  1970. X*   NOTES
  1971. X*
  1972. X*   SEE ALSO
  1973. X*    CreateFamily(), EmptyMorgue(), LaunchChildl(), LaunchChildv(),
  1974. X*    OrphanChild(), OrphanChildren(), WaitChild().
  1975. X*
  1976. X*   BUGS
  1977. X*    None known.
  1978. X*
  1979. X******************************************************************************
  1980. X*
  1981. X*/
  1982. X
  1983. X#include <rsbx/childtasking.h>
  1984. X
  1985. Xstruct ChildNode *ChildStatus(struct ChildNode *child, long *status)
  1986. X    {
  1987. X    struct ChildNode *node;
  1988. X
  1989. X    EmptyMorgue();
  1990. X
  1991. X    for (node = (struct ChildNode *)_Children->ChildList.mlh_Head;
  1992. X        node->node.mln_Succ;
  1993. X        node = (struct ChildNode *)node->node.mln_Succ)
  1994. X        {
  1995. X        if (node == child)
  1996. X            {
  1997. X            if (!child->notice.noticeptr)
  1998. X                {
  1999. X                *status = child->notice.ret;
  2000. X                return child;
  2001. X                }
  2002. X            else
  2003. X                {
  2004. X                *status = 0;
  2005. X                return 0;
  2006. X                }
  2007. X            }
  2008. X        }
  2009. X
  2010. X    *status = -1;
  2011. X    return 0;
  2012. X    }
  2013. SHAR_EOF
  2014. echo "extracting rsbx.lib/orphanchildren.c"
  2015. sed 's/^X//' << \SHAR_EOF > rsbx.lib/orphanchildren.c
  2016. X/****** rsbx.lib/OrphanChildren() ********************************************
  2017. X*
  2018. X*   NAME
  2019. X*    OrphanChildren -- Orphan all child processes of this process.
  2020. X*
  2021. X*   SYNOPSIS
  2022. X*    OrphanChildren()
  2023. X*
  2024. X*    void OrphanChildren( void );
  2025. X*
  2026. X*   FUNCTION
  2027. X*    This function orphans all child processes of this process and frees
  2028. X*        the memory used to keep track of the children.
  2029. X*
  2030. X*   INPUTS
  2031. X*
  2032. X*   RESULT
  2033. X*
  2034. X*   NOTES
  2035. X*
  2036. X*   SEE ALSO
  2037. X*    ChildStatus(), CreateFamily(), EmptyMorgue(), LaunchChildl(),
  2038. X*    LaunchChildv(), OrphanChild(), WaitChild().
  2039. X*
  2040. X*   BUGS
  2041. X*    None Known.
  2042. X*
  2043. X******************************************************************************
  2044. X*
  2045. X*/
  2046. X
  2047. X#include <rsbx/childtasking.h>
  2048. X
  2049. Xvoid OrphanChildren( void )
  2050. X    {
  2051. X    struct ChildNode *node;
  2052. X
  2053. X    Forbid();
  2054. X    EmptyMorgue();
  2055. X    DeletePort(_Children->Morgue);
  2056. X
  2057. X    while ((node = (struct ChildNode *)_Children->ChildList.mlh_Head) &&
  2058. X        node->node.mln_Succ)
  2059. X        {
  2060. X        if (node->notice.noticeptr)
  2061. X            {
  2062. X            *node->notice.noticeptr = NULL;
  2063. X            }
  2064. X        Remove((struct Node *)node);
  2065. X        FreeMem(node, sizeof(struct ChildNode));
  2066. X        }
  2067. X
  2068. X    FreeMem(_Children, sizeof(*_Children));
  2069. X    _Children = NULL;
  2070. X    
  2071. X    Permit();
  2072. X    }
  2073. SHAR_EOF
  2074. echo "extracting rsbx.lib/escaping.c"
  2075. sed 's/^X//' << \SHAR_EOF > rsbx.lib/escaping.c
  2076. X/****** rsbx.lib/EscapeAdditions() *******************************************
  2077. X*
  2078. X*   NAME
  2079. X*    EscapeAdditions -- Return number of characters to escape an argument.
  2080. X*
  2081. X*   SYNOPSIS
  2082. X*    escapes = EscapeAdditions(argv)
  2083. X*
  2084. X*    int EscapeAdditions(char *);
  2085. X*
  2086. X*   FUNCTION
  2087. X*    Determines the number of extra characters that are needed to escape
  2088. X*        a command argument for AmigaDos command parsing.
  2089. X*
  2090. X*   INPUTS
  2091. X*    argv          - Argument to check.
  2092. X*
  2093. X*   RESULT
  2094. X*    escapes       - The number of characters that need to be added to the
  2095. X*                    argument to escape the characters special to AmigaDos.
  2096. X*
  2097. X*   NOTES
  2098. X*    Characters special to AmigaDos are " [0x22], * [0x2a], ESC [0x1b],
  2099. X*        LF [0x0a], SP [0x20].
  2100. X*
  2101. X*   SEE ALSO
  2102. X*    EscapeAdditions(), EscapeString().
  2103. X*
  2104. X*   BUGS
  2105. X*    Thinks spaces need an AmigaDos escape character preceeding them.
  2106. X*
  2107. X******************************************************************************
  2108. X*
  2109. X*/
  2110. X
  2111. X#include <stdio.h>
  2112. X#include <string.h>
  2113. X
  2114. X
  2115. X#define QUOTE '\"'
  2116. X#define ESCAPE '*'
  2117. X#define ESC '\033'
  2118. X#define NL '\n'
  2119. X#define SPACE ' '
  2120. X
  2121. X#define SPECIAL "\"*\033\n "
  2122. X
  2123. X
  2124. Xint EscapeAdditions(char *argv);
  2125. Xchar *EscapeString(char *buff, char *argv);
  2126. X
  2127. X
  2128. Xint EscapeAdditions(char *argv)
  2129. X    {
  2130. X    int count = 0;
  2131. X    char *pos = argv;
  2132. X
  2133. X    while (pos = strpbrk(pos, SPECIAL))
  2134. X        {
  2135. X        count++;
  2136. X        pos++;
  2137. X        }
  2138. X
  2139. X    if (count)
  2140. X        {
  2141. X        count += 2;
  2142. X        }
  2143. X
  2144. X    return count;
  2145. X    }
  2146. X
  2147. X
  2148. X/****** rsbx.lib/EscapeString() **********************************************
  2149. X*
  2150. X*   NAME
  2151. X*    EscapeString -- Copy argument to buffer escaping as needed.
  2152. X*
  2153. X*   SYNOPSIS
  2154. X*    dest = EscapeString(buffer, argv)
  2155. X*
  2156. X*    char *EscapeAdditions(char *, char *);
  2157. X*
  2158. X*   FUNCTION
  2159. X*    Copies a string containing a single argument to a buffer, escaping
  2160. X*        characters special to AmigaDos.
  2161. X*
  2162. X*   INPUTS
  2163. X*    buffer        - Buffer for escaped argument string.
  2164. X*    argv          - Argument string to escape.
  2165. X*
  2166. X*   RESULT
  2167. X*    dest          - The same as buffer.
  2168. X*
  2169. X*   NOTES
  2170. X*    Characters special to AmigaDos are " [0x22], * [0x2a], ESC [0x1b],
  2171. X*        LF [0x0a], SP [0x20].
  2172. X*
  2173. X*   SEE ALSO
  2174. X*    EscapeAdditions(), EscapeString().
  2175. X*
  2176. X*   BUGS
  2177. X*    Thinks spaces need an AmigaDos escape character preceeding them.
  2178. X*
  2179. X******************************************************************************
  2180. X*
  2181. X*/
  2182. X
  2183. Xchar *EscapeString(char *buff, char *argv)
  2184. X    {
  2185. X    char *pos;
  2186. X
  2187. X    pos = buff;
  2188. X    *pos++ = '\"';
  2189. X    while (*argv)
  2190. X        {
  2191. X        switch (*argv)
  2192. X            {
  2193. X            case ESC:
  2194. X                *pos++ = ESCAPE;
  2195. X                *pos++ = 'E';
  2196. X                break;
  2197. X            case NL:
  2198. X                *pos++ = ESCAPE;
  2199. X                *pos++ = 'N';
  2200. X                break;
  2201. X            case QUOTE:
  2202. X            case SPACE:
  2203. X            case ESCAPE:
  2204. X                *pos++ = ESCAPE;
  2205. X            default:
  2206. X                *pos++ = *argv;
  2207. X            }
  2208. X        argv++;
  2209. X        }
  2210. X    *pos++ = '\"';
  2211. X    *pos = '\0';
  2212. X
  2213. X    return buff;
  2214. X    }
  2215. SHAR_EOF
  2216. echo "extracting rsbx.lib/makefile"
  2217. sed 's/^X//' << \SHAR_EOF > rsbx.lib/makefile
  2218. X#$Header$
  2219. X#
  2220. X# Compiler level:
  2221. X#    Lattice 5.04.01
  2222. X#
  2223. X# Compiler and linker options:
  2224. X#    This Makefile is distributed with the -d3 option turned on and the optimizer
  2225. X#    option turned off because it yields working executables. Other combinations
  2226. X#    may also yield working executables, but removing "-d3" and turing on the
  2227. X#    optimizer didn't.
  2228. X#
  2229. X#
  2230. X.SILENT:
  2231. X#
  2232. X#
  2233. XCC1 = LC:lc1
  2234. XCC2 = LC:go
  2235. XCC3 = LC:lc2
  2236. XC1FLAGS    = -d3
  2237. XC2FLAGS    =
  2238. XC3FLAGS    =
  2239. X#
  2240. XASM = LC:asm
  2241. XASMFLAGS = -iinclude:
  2242. X#
  2243. X#
  2244. X#.c.o:
  2245. X#    $(CC1) -. $(C1FLAGS) $(CFLAGS) -oQUAD: $*
  2246. X#    $(CC2) -. $(C2FLAGS) QUAD:$*.q
  2247. X#    $(CC3) -. $(C3FLAGS) -o$*.o QUAD:$*.q
  2248. X#
  2249. X.c.o:
  2250. X    $(CC1) -. $(C1FLAGS) $(CFLAGS) -oQUAD: $*
  2251. X    $(CC3) -. $(C3FLAGS) -o$*.o QUAD:$*.q
  2252. X    rename $*.o $*.z
  2253. X    -lc:blink prelink nodebug from $*.z to $*.o
  2254. X    delete $*.z
  2255. X#
  2256. X#
  2257. X.asm.o:
  2258. X    $(ASM) -. $(ASMFLAGS) $*.asm
  2259. X#
  2260. X#
  2261. X
  2262. XCDEFINES =
  2263. XCFLAGS     = $(CDEFINES)
  2264. X
  2265. X
  2266. XTARGETS = rsbx.lib xc.o
  2267. X
  2268. X
  2269. Xall:    $(TARGETS)
  2270. X
  2271. X
  2272. Xinstall:
  2273. X    copy rsbx.lib LIB:
  2274. X    copy xc.o LIB:
  2275. X
  2276. X
  2277. Xclean:
  2278. X    -delete \#?.o
  2279. X    -delete $(TARGETS)
  2280. X
  2281. X
  2282. XRSBXOBJ = childstatus.o createfamily.o emptymorgue.o escaping.o launchc.o orphanchild.o orphanchildren.o popen.o ulseg.o uxmain.o waitchild.o
  2283. Xrsbx.lib:    $(RSBXOBJ)
  2284. X    oml $@ r $?
  2285. X
  2286. X
  2287. X#SOURCE = childstatus.c createfamily.c emptymorgue.c escaping.c launchc.c orphanchild.c orphanchildren.c popen.c ulseg.asm uxmain.c waitchild.c xc.asm
  2288. X#
  2289. X#HFILES = INCLUDE:rsbx/childtasking.h
  2290. X#
  2291. X#depend:    ${SOURCE} ${HFILES}
  2292. X#    (sed '/^# DO NOT DELETE THIS LINE/q' Makefile && \
  2293. X#     cc -Em ${CFLAGS} ${SOURCE} | sed 's/\.\///; /\//d' \
  2294. X#    ) >Makefile.new
  2295. X#    cp Makefile Makefile.bak
  2296. X#    cp Makefile.new Makefile
  2297. X#    rm -f Makefile.new
  2298. X
  2299. X
  2300. X# DO NOT DELETE THIS LINE - 
  2301. Xchildstatus.c: INCLUDE:rsbx/childtasking.h
  2302. Xchildstatus.o: childstatus.c
  2303. Xcreatefamily.c: INCLUDE:rsbx/childtasking.h
  2304. Xcreatefamily.o: createfamily.c
  2305. Xemptymorgue.c: INCLUDE:rsbx/childtasking.h
  2306. Xemptymorgue.o: emptymorgue.c
  2307. Xescaping.o: escaping.c
  2308. Xlaunchc.c: INCLUDE:rsbx/childtasking.h
  2309. Xlaunchc.o: launchc.c
  2310. Xorphanchild.c: INCLUDE:rsbx/childtasking.h
  2311. Xorphanchild.o: orphanchild.c
  2312. Xorphanchildren.c: INCLUDE:rsbx/childtasking.h
  2313. Xorphanchildren.o: orphanchildren.c
  2314. Xpopen.c: INCLUDE:rsbx/childtasking.h
  2315. Xpopen.o: popen.c
  2316. Xulseg.o: ulseg.asm
  2317. Xuxmain.o: uxmain.c
  2318. Xwaitchild.c: INCLUDE:rsbx/childtasking.h
  2319. Xwaitchild.o: waitchild.c
  2320. Xxc.o: xc.asm
  2321. SHAR_EOF
  2322. echo "extracting rsbx.lib/orphanchild.c"
  2323. sed 's/^X//' << \SHAR_EOF > rsbx.lib/orphanchild.c
  2324. X/****** rsbx.lib/OrphanChild() ***********************************************
  2325. X*
  2326. X*   NAME
  2327. X*    OrphanChild -- Dis-associate a child process from this process.
  2328. X*
  2329. X*   SYNOPSIS
  2330. X*    success = OrphanChild(child)
  2331. X*
  2332. X*    int OrphanChild(struct ChildNode * );
  2333. X*
  2334. X*   FUNCTION
  2335. X*    This function will dis-associate a child process from this process and
  2336. X*        free the structures used to track the child process.
  2337. X*
  2338. X*   INPUTS
  2339. X*    child         - Child identifier returned by LaunchChildl() or by
  2340. X*                    LaunchChildv().
  2341. X*
  2342. X*   RESULT
  2343. X*    success       - Zero if invalid child identifier.
  2344. X*
  2345. X*   NOTES
  2346. X*
  2347. X*   SEE ALSO
  2348. X*    ChildStatus(), CreateFamily(), EmptyMorgue(), LaunchChildl(),
  2349. X*    LaunchChildv(), OrphanChildren(), WaitChild().
  2350. X*
  2351. X*   BUGS
  2352. X*    None Known.
  2353. X*
  2354. X******************************************************************************
  2355. X*
  2356. X*/
  2357. X
  2358. X#include <rsbx/childtasking.h>
  2359. X
  2360. X/*
  2361. X * name        OrphanChild --
  2362. X *
  2363. X * synopsis    error = OrphanChild(child);
  2364. X *
  2365. X *        int error;                 error if 0
  2366. X *        struct ChildNode *child;   child identifier
  2367. X *
  2368. X * description    This function removes all records of a child process.
  2369. X *        Returns 0 if child unknown.
  2370. X */
  2371. X
  2372. Xint OrphanChild(struct ChildNode *child)
  2373. X    {
  2374. X    struct ChildNode *node;
  2375. X
  2376. X    Forbid();
  2377. X    EmptyMorgue();
  2378. X
  2379. X    for (node = (struct ChildNode *)_Children->ChildList.mlh_Head;
  2380. X        node->node.mln_Succ;
  2381. X        node = (struct ChildNode *)node->node.mln_Succ)
  2382. X        {
  2383. X        if (node == child)
  2384. X            {
  2385. X            if (child->notice.noticeptr)
  2386. X                {
  2387. X                *child->notice.noticeptr = 0;
  2388. X                }
  2389. X            Remove((struct Node*)child);
  2390. X            FreeMem(child, sizeof(*child));
  2391. X            return -1;
  2392. X            }
  2393. X        }
  2394. X
  2395. X    return 0;
  2396. X    }
  2397. SHAR_EOF
  2398. echo "extracting rsbx.lib/readme"
  2399. sed 's/^X//' << \SHAR_EOF > rsbx.lib/readme
  2400. XThis is the source directory for a scanned library neede to recreate the RCS
  2401. Xexecutables. Documentation, in AutoDoc format, for the library is in file
  2402. Xrsbx.lib.doc.
  2403. X
  2404. XTo make the library, place childtasking.h in directory INCLUDE:rsbx/ and type
  2405. X"lmk -f Makefile".
  2406. X
  2407. XTwo source files needed to build the library from scratch, launchc.c and
  2408. Xulseg.asm, are not included in the distribution because the original sources
  2409. Xthey were based on belong to Lattice. However, the object modules needed to to
  2410. Xmake the library are included.
  2411. X
  2412. X
  2413. X                        Ray
  2414. SHAR_EOF
  2415. echo "extracting rsbx.lib/createfamily.c"
  2416. sed 's/^X//' << \SHAR_EOF > rsbx.lib/createfamily.c
  2417. X/****** rsbx.lib/CreateFamily() **********************************************
  2418. X*
  2419. X*   NAME
  2420. X*    CreateFamily -- 
  2421. X*
  2422. X*   SYNOPSIS
  2423. X*    success = CreateFamily()
  2424. X*
  2425. X*    int CreateFamily( void );
  2426. X*
  2427. X*   FUNCTION
  2428. X*    This function initializes the structures used to keep track of child
  2429. X*        processes of this process.
  2430. X*
  2431. X*   INPUTS
  2432. X*
  2433. X*   RESULT
  2434. X*    success       - Zero if unable to allocate and initialize needed
  2435. X*                    structures.
  2436. X*
  2437. X*   NOTES
  2438. X*
  2439. X*   SEE ALSO
  2440. X*    ChildStatus(), EmptyMorgue(), LaunchChildl(), LaunchChildv(),
  2441. X*    OrphanChild(), OrphanChildren(), WaitChild().
  2442. X*
  2443. X*   BUGS
  2444. X*    None Known.
  2445. X*
  2446. X******************************************************************************
  2447. X*
  2448. X*/
  2449. X
  2450. X#include <proto/exec.h>
  2451. X#include <rsbx/childtasking.h>
  2452. X
  2453. Xint CreateFamily( void )
  2454. X    {
  2455. X    if (!_Children)
  2456. X        {
  2457. X        if (!(_Children = AllocMem(sizeof(*_Children), 0)))
  2458. X            {
  2459. X            return NULL;
  2460. X            }
  2461. X        NewList((struct List *)&_Children->ChildList);
  2462. X        _Children->Orphan = OrphanChildren;
  2463. X        if (!(_Children->Morgue = CreatePort(0, 0)))
  2464. X            {
  2465. X            FreeMem(_Children, sizeof(*_Children));
  2466. X            return NULL;
  2467. X            }
  2468. X        }
  2469. X
  2470. X
  2471. X    return -1;
  2472. X    }
  2473. SHAR_EOF
  2474. echo "extracting rsbx.lib/popen.c"
  2475. sed 's/^X//' << \SHAR_EOF > rsbx.lib/popen.c
  2476. X#include <stdio.h>
  2477. X#include <string.h>
  2478. X#include <ctype.h>
  2479. X#include <dos.h>
  2480. X#include <ios1.h>
  2481. X#include <fcntl.h>
  2482. X#include <libraries/dosextens.h>
  2483. X#include <exec/lists.h>
  2484. X#include <exec/nodes.h>
  2485. X#include <rsbx/ChildTasking.h>
  2486. X
  2487. X
  2488. Xstruct pstruct {
  2489. X    struct MinNode node;
  2490. X    FILE    *fptr1;
  2491. X    struct ChildNode *child;
  2492. X    };
  2493. X
  2494. Xstatic struct MinList PList = { 0 };
  2495. X
  2496. X
  2497. XFILE *popenl(char *args, ...);
  2498. XFILE *popenv(char **args, char *mode);
  2499. Xint pclose(FILE *fptr);
  2500. Xstatic char *mktemp(char *template);
  2501. X
  2502. X
  2503. X
  2504. X/****** rsbx.lib/popenl() ****************************************************
  2505. X*
  2506. X*   NAME
  2507. X*    popenl -- Initiate I/O to or from a command.
  2508. X*
  2509. X*   SYNOPSIS
  2510. X*    pipe = popenl(arg0, ..., argn, NULL, mode)
  2511. X*
  2512. X*    FILE *popenl(char *, char *, ...);
  2513. X*
  2514. X*   FUNCTION
  2515. X*    Creates a stream between the calling process and the stdin or stdout
  2516. X*        streams of the command it executes. Mode should be "r" to read
  2517. X*        the stdout stream of the command, or "w" to write to the stdin
  2518. X*        stream of the command. 
  2519. X*
  2520. X*   INPUTS
  2521. X*    arg0          - Name of file to execute.
  2522. X*       ...           - Other command line arguments needed by the file to be
  2523. X*                    executed.
  2524. X*    NULL          - Zero.
  2525. X*    mode          _ I/O mode string.
  2526. X*
  2527. X*   RESULT
  2528. X*    pipe          - File pointer to use to read or write to the command
  2529. X*                    with.
  2530. X*
  2531. X*   NOTES
  2532. X*    A stream opened by popenl() should be closed by pclose().
  2533. X*
  2534. X*   SEE ALSO
  2535. X*    popenv(), pclose().
  2536. X*
  2537. X*   BUGS
  2538. X*    This function does not create a complete CLI enviroment for the child
  2539. X*        process. Use of this function with a command that expects a BCPL
  2540. X*        environment will crash the system. The Unix function 'popen' takes
  2541. X*        as arguments a command string which it passes to the shell, and a
  2542. X*        mode string.
  2543. X*
  2544. X******************************************************************************
  2545. X*
  2546. X*/
  2547. X
  2548. XFILE *popenl(char *args, ...)
  2549. X    {
  2550. X    char **nullarg;
  2551. X
  2552. X    for(nullarg = (char **)(&args); *nullarg != 0; nullarg++);
  2553. X
  2554. X    return(popenv(&args, *(nullarg+1)));
  2555. X    }
  2556. X
  2557. X
  2558. X/****** rsbx.lib/popenv() ****************************************************
  2559. X*
  2560. X*   NAME
  2561. X*    popenv -- Initiate I/O to or from a command.
  2562. X*
  2563. X*   SYNOPSIS
  2564. X*    pipe = popenv(argv, mode)
  2565. X*
  2566. X*    FILE *popenv(char **, char *);
  2567. X*
  2568. X*   FUNCTION
  2569. X*    Creates a stream between the calling process and the stdin or stdout
  2570. X*        streams of the command it executes. Mode should be "r" to read
  2571. X*        the stdout stream of the command, or "w" to write to the stdin
  2572. X*        stream of the command. 
  2573. X*
  2574. X*   INPUTS
  2575. X*    argv          - An array of pointer to the argument strings for the
  2576. X*                    command. The last pointer must be followed by a 0
  2577. X*                    pointer. The first pointer, argv[0], is the name of
  2578. X*                    file to execute.
  2579. X*    mode          _ I/O mode string.
  2580. X*
  2581. X*   RESULT
  2582. X*    pipe          - File pointer to use to read or write to the command
  2583. X*                    with.
  2584. X*
  2585. X*   NOTES
  2586. X*    A stream opened by popenv() should be closed by pclose().
  2587. X*
  2588. X*   SEE ALSO
  2589. X*    popenl(), pclose().
  2590. X*
  2591. X*   BUGS
  2592. X*    This function does not create a complete CLI enviroment for the child
  2593. X*        process. Use of this function with a command that expects a BCPL
  2594. X*        environment will crash the system. The Unix function 'popen' takes
  2595. X*        as arguments a command string which it passes to the shell, and a
  2596. X*        mode string.
  2597. X*
  2598. X******************************************************************************
  2599. X*
  2600. X*/
  2601. X
  2602. XFILE *popenv(char **args, char *mode)
  2603. X    {
  2604. X    struct LAUNCHENV env = { 0,0,0,0,0,0,0 };
  2605. X    static char tempname[] = "pipe:popen.XXXX.XXXXXXXX";
  2606. X    char *pname;
  2607. X    char redir[64];
  2608. X    struct pstruct *poptr;
  2609. X    char *mode1;
  2610. X    int mode2;
  2611. X    int f2;
  2612. X
  2613. X    if (!PList.mlh_Head)
  2614. X        {
  2615. X        NewList(&PList);
  2616. X        }
  2617. X
  2618. X    if ((strcmp(mode,"r") != 0) && (strcmp(mode,"w") != 0))
  2619. X        {
  2620. X        fprintf(stderr,"popen: bad mode!\n");
  2621. X        return(NULL);
  2622. X        }
  2623. X
  2624. X    if (*mode == 'r')
  2625. X        {
  2626. X        mode1 = "r";
  2627. X        mode2 = MODE_NEWFILE;
  2628. X        }
  2629. X    else
  2630. X        {
  2631. X        mode1 = "w";
  2632. X        mode2 = MODE_OLDFILE;
  2633. X        }
  2634. X
  2635. X    strcpy(redir,tempname);
  2636. X
  2637. X    if (!(poptr = (struct pstruct *)malloc(sizeof(struct pstruct))))
  2638. X        {
  2639. X        fprintf(stderr,"popen: Out of memory!\n");
  2640. X        return(NULL);
  2641. X        }
  2642. X
  2643. X    if (!(pname = mktemp(redir)))
  2644. X        {
  2645. X        fprintf(stderr,"popen: Unable to find an available pipe.\n");
  2646. X        free(poptr);
  2647. X        return(NULL);
  2648. X        }
  2649. X
  2650. X    if (!(poptr->fptr1 = fopen(pname, mode1)))
  2651. X        {
  2652. X        fprintf(stderr,"popen: Unable to open pipe end 1 file %s mode %s\n", pname, mode);
  2653. X        free(poptr);
  2654. X        return(NULL);
  2655. X        }
  2656. X
  2657. X    if (!(f2 = Open(pname, mode2)))
  2658. X        {
  2659. X        fprintf(stderr,"popen: Unable to open pipe end 2 file %s mode %s\n", pname, mode);
  2660. X        fclose(poptr->fptr1);
  2661. X        free(poptr);
  2662. X        return(NULL);
  2663. X        }
  2664. X
  2665. X    env.priority = ((struct Task *)FindTask(NULL))->tc_Node.ln_Pri;
  2666. X    if (*mode == 'r')
  2667. X        {
  2668. X        env.std_out = f2;
  2669. X        }
  2670. X    else
  2671. X        {
  2672. X        env.std_in = f2;
  2673. X        }
  2674. X    env.le_fh1 = f2;
  2675. X
  2676. X    if (!(poptr->child = LaunchChildv(&env, *args, args)))
  2677. X        {
  2678. X        fprintf(stderr,"popen: Fork failed\n");
  2679. X        Close(f2);
  2680. X        fclose(poptr->fptr1);
  2681. X        free(poptr);
  2682. X        return(NULL);
  2683. X        }
  2684. X
  2685. X    AddTail(&PList, poptr);
  2686. X
  2687. X    return(poptr->fptr1);
  2688. X    }
  2689. X
  2690. X
  2691. X/****** rsbx.lib/pclose() ****************************************************
  2692. X*
  2693. X*   NAME
  2694. X*    pclose -- Closes pipe opened by popenl() or by popenv().
  2695. X*
  2696. X*   SYNOPSIS
  2697. X*    status = pclose(pipe)
  2698. X*
  2699. X*    int pclose(FILE *);
  2700. X*
  2701. X*   FUNCTION
  2702. X*    Waits for the command associated with the pipe to exit, closes the
  2703. X*        stream, and returns the return code from the command.
  2704. X*
  2705. X*   INPUTS
  2706. X*    pipe          - Stream pointer returned by a call to popenl() or to
  2707. X*                    popenv().
  2708. X*
  2709. X*   RESULT
  2710. X*    status        - The return code from the command executed, or -1 if
  2711. X*                    pipe wasn't opened by popenl() or by popenv().
  2712. X*
  2713. X*   NOTES
  2714. X*
  2715. X*   SEE ALSO
  2716. X*    popenl(), popenv().
  2717. X*
  2718. X*   BUGS
  2719. X*    None known.
  2720. X*
  2721. X******************************************************************************
  2722. X*
  2723. X*/
  2724. X
  2725. Xint pclose(FILE *fptr)
  2726. X    {
  2727. X    long status;
  2728. X    struct pstruct *poptr;
  2729. X
  2730. X    for (poptr = (struct pstruct *)PList.mlh_Head;
  2731. X        poptr->node.mln_Succ;
  2732. X        poptr = (struct pstruct *)poptr->node.mln_Succ)
  2733. X        {
  2734. X        if (poptr->fptr1 == fptr)
  2735. X            {
  2736. X            Remove(poptr);
  2737. X            fclose(poptr->fptr1);
  2738. X            if (!WaitChild(poptr->child, &status))
  2739. X                {
  2740. X                status = -1;
  2741. X                }
  2742. X            free(poptr);
  2743. X            return(status);
  2744. X            }
  2745. X        }
  2746. X
  2747. X    return -1;
  2748. X    }
  2749. X
  2750. Xstatic unsigned short Generation = 0;
  2751. X
  2752. Xstatic char *hex = "0123456789abcdef";
  2753. X
  2754. Xstatic char *mktemp(char *template)
  2755. X    {
  2756. X    char *cp;
  2757. X    unsigned long val;
  2758. X
  2759. X    cp = template;
  2760. X    cp += strlen(template);
  2761. X
  2762. X    val = (unsigned long) FindTask(0L);
  2763. X    while (*--cp == 'X')
  2764. X        {
  2765. X        *cp = hex[val%16];
  2766. X        val /= 16;
  2767. X        }
  2768. X
  2769. X    val = Generation++;
  2770. X    while (*--cp == 'X')
  2771. X        {
  2772. X        *cp = hex[val%16];
  2773. X        val /= 16;
  2774. X        }
  2775. X
  2776. X    return template;
  2777. X    }
  2778. SHAR_EOF
  2779. echo "extracting rsbx.lib/rsbx.lib.uu"
  2780. sed 's/^X//' << \SHAR_EOF > rsbx.lib/rsbx.lib.uu
  2781. X
  2782. Xbegin 640 rsbx.lib
  2783. XM```#^@``""8```/I````+$Y5__R_[```90```$CG`#(F;0`()&T`#$ZZ```@R
  2784. XM"V<^(&P``"MH``3__"!M__Q*D&<@(&W__+'+9@Y*JP`<9A(DJP`@(`M@7B!M=
  2785. XM__PK4/_\8-@@;?_\2I!F.'``8$@@;```*V@`!/_\(&W__$J09R(@;?_\2J@`$
  2786. XM'&8.(&W__"2H`"`@+?_\8!X@;?_\*U#__(&P``"!H`!`L>``$3J[^@&``D
  2787. XM_W1,WTP`3EU.=0`````#[X8```-?7T-H:6QD<F5N```````#````E````&``Q
  2788. XM```B@P```U]%;7!T>4UO<F=U90````$````:@P```E]?>&-O=F8``````0``*
  2789. XM``J&```"7U]B87-E```````!````!@````````/R```#Z0```+1.5?_XO^P`,
  2790. XM`&4```!(YR,2)FT`""XM``PL;```3J[_RBE```0L;```3J[_Q"E```Q![```.
  2791. XM(@@D/````^TL;```3J[_XBE``!0`K```@!$```"L``"`$@`(`*P``(`#`!!P>
  2792. XM`"E``!QP`2E``#YP`BE``&!*K```9P1P`&`&(#P``(``+``@!@!```$I0``8_
  2793. XM(`8`0``"*4``.B`&`$``@"E``%Q!^@``*4@``"!L```0*/__2(!(P-"'5(`O.
  2794. XM`$ZZ``!83RM`__Q*@&8*2'@``4ZZ``!83R`L`!CE@%*L`!A![``<(:W__`@`X
  2795. XM(&P``!`H__](@$C`+P`O""\M__Q.N@``3^\`#"!L```0*/__2(`@;?_\T,`KN
  2796. XM2/_\(&W__$(8*TC__`RL```!```8;``!0A`3<B"P`6<,<@FP`6<&<@JP`68*B
  2797. XM2H=G!E*+4X=@XDJ'9P`!'B`L`!CE@%*L`!A![``<(:W__`@`<"*P$V8``,!24
  2798. XMBU.'2H=G;!`3<B*P`6=D<"JP$V904HM3AV8,+RP`'&$``/I83V#<$!-(@`1`<
  2799. XM`$5G"`1```EG$&`<(&W__!#\`!<K2/_\8!@@;?_\$/P`"BM(__Q@"B!M__P03
  2800. XMTRM(__Q3AU*+8)X@;?_\$-LK2/_\4X=@D$J'9@HO+``<80``GEA/4HM3AR!M#
  2801. XM__Q"&"M(__Q*AV<`_R`0$W(@L`%G`/\6<@FP`6<`_PYR"K`!9P#_!B\L`!QA-
  2802. XM``!F6$]@`/[X2H=G(A`3<B"P`6<:<@FP`6<4<@JP`6<.(&W__!#;*TC__%.'H
  2803. XM8-I*AV8*<``@;?_\$(!@#B!M__Q"&"M(__Q@`/ZV2&P`'"\L`!A.N@``0I=.'
  2804. XMN@``3.U(Q/_D3EU.=4Y5``"_[```90```"\+)FT`"$AL`$1(;``"3KH``$AL"
  2805. XM`$0O"TZZ``!(;`!$2'@`"DZZ``!(>`!D3KH``"9M__Q.74YU``````/X````S
  2806. XM#@````$```)T```"<````B````'H```!C````5X```%:```!5````2@```#@G
  2807. XM````W````-8```*B````,@````````/O@P```E]F<'5T8P```````0```KR#"
  2808. XM```"7V9P=71S```````"```"L````J:#```"7V5X:70````````"```"Q```5
  2809. XM`GZ#```"7VUA:6X````````!```">(,```)?<W1R;F-P>0````$```#^@P``]
  2810. XM`E]?97AI=````````0```-"#```"7VUA;&QO8P`````!````OH8```1?7U!RP
  2811. XM;V=R86U.86UE`````````P```08```#J````K(8```-?7T].0E)%04L``````
  2812. XM```!````J(,```)?0UA"4DL```````$```"DA@```E]?9FUO9&4``````0``^
  2813. XM`'2&```"7U]I;V(````````)```"M````JH```*>````H````)8```",````!
  2814. XM<````&H```!DA@```E]?=69B<P``````!@```%X```!6````3@```$8````NP
  2815. XM````(H8```)?1$]30F%S90````,````^````)@```!J#```"7U]X8V]V9@``4
  2816. XM```"```"E`````J&```"7U]B87-E```````"```"D`````8````````#\@``2
  2817. XM`^H```$'*@!);G9A;&ED(&%R9W5M96YT('1O(```````````````````````,
  2818. XM`````````````````````````````````````````````````````````````
  2819. XM`````````````````````````````````````````````````````````````
  2820. XM`````````````````````````````````````````````````````````````
  2821. XM`````````````````````````````````````````````````````````````
  2822. XM`````````````````````````````````````````````````````````````
  2823. XM`````````````````````````````````````````````````````````````
  2824. XM`````````````````````````````````````````````````````````````
  2825. XM`````````````````````````````````````````````````````````````
  2826. XM`````````````````````````````````````````````````````````````
  2827. XM`````````````````````````````````````````````````````````````
  2828. XM`````````````````````````````````````````````````````````````
  2829. XM`````````````````````````````````````````````````````````````
  2830. XM`````````````````````````````````````````````````````````````
  2831. XM`````````````````````````````````````````````````````````````
  2832. XM`````````````````````````````````````````````````````````````
  2833. XM`````````````````````````````````````````````````````````````
  2834. XM`````````````````````````````````````````````````````````````
  2835. XM`````````````````````````````````````````````````````````````
  2836. XM`````````````````````````````````````````````````````````````
  2837. XM`````````````````````````````````````````````````````````````
  2838. XM`````````````````````````````````````````````````````````````
  2839. XM`````````````````````````````````````````````````````````````
  2840. XM``````````````````````````````````/R```#Z@```%````%``````&`4G
  2841. XM``````````````````````````!(YW_^+'@`!)/)3J[^VBA`0>P`7$ZN_H!!P
  2842. XM[`!<3J[^C")`1?K_R"5I`"@`#"5I`"P`$"5I`"``!"5I`!P``"5I`"0`"$'J#
  2843. XM``@D4"5(`!0@:0`4("D`&$CG@(!.KOZ&(FP`@%:)T\G3R2*Z_WQ#^O]T("D`?
  2844. XM!.6(6(`B0$S?`0$B+``Z)`\$@@```!24@2\L`+!(YP`*+P(I3P"P3I%8CTS?0
  2845. XM4``I7P"P+P!%^O]"(CK_."\.+&H``$ZN_V0L7R(L`)@O#BQJ``!.KO^F+%\B.
  2846. XM*@`,9PPO#BQJ``!.KO_<+%\B*@`09PPO#BQJ``!.KO_<+%\B:@``3J[^8DZN&
  2847. XM_WP@*@`(9QHB0"-?`!A"J0`40JD`#B!J``0B:@`(3J[^DDS??_Y.=0```_(`0
  2848. XM``/I````($Y5__R_[```90```$ZZ``!.N@``(&P``"\H`!!.N@``6$\B;```Z
  2849. XM(&D`!"M(__P@"&<V(&W__$J09RX@;?_\2J@`'&<*(FW__"!I`!Q"D"\M__Q.D
  2850. XMN@``2'@`)"\M__Q.N@``3^\`#&"Z2'@`%"\L``!.N@``0JP``$ZZ``!.74YU\
  2851. XM```#[X,```)?4&5R;6ET``````$```!Z@P```E]&<F5E365M`````@```'(`[
  2852. XM``!@@P```E]296UO=F4``````0```%2#```#7T1E;&5T95!O<G0``````0``E
  2853. XM`!Z&```#7U]#:&EL9')E;@``````!````'8```!N````)````!:#```#7T5M'
  2854. XM<'1Y36]R9W5E`````0```!*#```"7T9O<F)I9``````!````#H,```)?7WAC&
  2855. XM;W9F``````$````*A@```E]?8F%S90```````0````8````````#\@```^D`?
  2856. XM```:3E7__+_L``!E````+PLF;0`(3KH``$ZZ```@;```*V@`!/_\(&W__$J0M
  2857. XM9S(@;?_\L<MF($JK`!QG!B!K`!Q"D"\+3KH``$AX`"0O"TZZ``!P_V`,(&W_I
  2858. XM_"M0__Q@QG``)FW_^$Y=3G4```/O@P```E]&<F5E365M`````0```$Z#```"+
  2859. XM7U)E;6]V90`````!````1(8```-?7T-H:6QD<F5N```````!````'(,```-?$
  2860. XM16UP='E-;W)G=64````!````&(,```)?1F]R8FED``````$````4@P```E]?I
  2861. XM>&-O=F8``````0````J&```"7U]B87-E```````!````!@````````/R```#1
  2862. XMZ0```5M.50``O^P``&4```!(YP`P)FT`""1M``Q(;0`0+PHO"V$```Q,[0P`Y
  2863. XM__A.74YU3E7_L+_L``!E````2.<_,B9M``@D;0`,3KH``$J`9@9P`&``!1`OQ
  2864. XM"DZZ``!83RM`_^!2@&<`!/P@"V8$1^P``)/)+'@`!$ZN_MHK0/_`2JL`!&80U
  2865. XM(&W_P"`H`#Z0J``Z)T``!`RK```@```$9`H@/```(``G0``$("L`!%:``D#_%
  2866. XM_"=```1^`7P`(`?E@"!M`!!*L`@`9SH@!^6`(&T`$"!P"`!*&&;\4X@B;0`0M
  2867. XMD?$(`"`'Y8`O,0@`+T@`*$ZZ``!83R(O`"32@%*!W(%2AV"X2H97P$0`2(!(O
  2868. XMP%*&2H!G`E*&.7P`!``V<``I0``X*48`/"E\``$``0!`<$`I0`!$0JP`2")M7
  2869. XM`!`@44H89OQ3B)'1(`A4@"E``$Q"K`!0*6P```!40>P`*"QX``1.KO\B*T#_>
  2870. XMN"`M_[@(```?9Q`B+?_@+&P``$ZN_Z9@``/D(&W_N"MH`!#__"!M_[@K:``89
  2871. XM_[0B;?^X(&D`("M(_]@@;?^X*V@`*/_L("W_V"(`Y($@;?^T(4$`$"!M_]A2I
  2872. XMK?_8+&T`$")62AEF_%.)D]8@"1"`(FT`$"!1(FW_V!+89OQ^`7P`(`?E@"!M^
  2873. XM`!!*L`@`9P``@B`'Y8`@;0`0+S`(`$ZZ``!83RH`2H5G'"!M__S1QB`'Y8`B#
  2874. XM;0`0+S$(`"\(3KH``%!/8!8@;?_\T<8@!^6`(FT`$")Q"``0V6;\(`?E@"!M"
  2875. XM`!`@<`@`2AAF_%.((FT`$)'Q"``@"-"%W(`@1E*&(FW__"`($[P`(`@`4H=@I
  2876. XM`/]R2H9G`E.&($92AB)M__P@"!.\``H(`"!M__Q",&@`(BW_X"QL``!.KO^"Y
  2877. XM*T#_X"(`3J[_H"M`_]PB"BQL``!.KO]J*T#_Y"(M_^`L;```3J[_@B(`3J[_D
  2878. XMIDJM_^1G``)V("P``$'L```B;?_L8`(2V%.`9/H@;?_L*TC_Z%BM_^@@;?_H!
  2879. XM(*W_Y"`M_^CD@"M`_^A(>``P3KH``%A/*T#_S$J`9P`")"!M_\PQ?``<`!)"[
  2880. XMIT*G3KH``%!/(&W_S"%```YG``'Z(&W_S"%M__P`%"!M_\PA1@`80^P`''``G
  2881. XM+'@`!$ZN_=@@;?_,(4``'&<``<!P)'(`+'@`!$ZN_SHK0/_42H!G``&:(&W_O
  2882. XMU%"((FW_S"-(`"0@+?_H(@HF`"03*"L`!"QL``!.KO]V*T#_T$J`9P`!7B!M)
  2883. XM_]`K:``0_[P@;?^\2J@`2F80(&W_O-#\`$HO"$ZZ``!83R!M_[S0_`!*(FW_7
  2884. XMN"QX``1.KO\*(&W_O"%M_]P`F"!M_\`B;?^\(V@`J`"H("W_M.2`(&W_O"%`L
  2885. XM`*Q*JP`09QH@*P`0Y8`K0/_$(&W_Q")M_[PC:``(`*1@#B!M_\`B;?^\(V@``
  2886. XMI`"D2JL`"&<,(&W_O"%K``@`G&`.(&W_P")M_[PC:`"<`)Q*JP`,9PP@;?^\S
  2887. XM(6L`#`"@8`X@;?_`(FW_O"-H`*``H"!M_\PA:P`4`"@@;?_,(6L`&``L(&P`;
  2888. XM`")M_\PC:``0`"`@;```6(@B;?_4+'@`!$ZN_PH@;?_0(FW_S"QX``1.KOZ2Z
  2889. XM(&W_S"!H``XL>``$3J[^@"M`_\BPK?_,9Q@@;?_,(&@`#BQX``1.KOZ,(D!.U
  2890. XMKOZ&8,X@;?_,+R@`#DZZ```NK?_,3KH``"`M_]1@7")M_]1P)"QX``1.KO\NV
  2891. XM(FW_S")I`!PL>``$3J[^8B!M_\PO*``.3KH``%A/+RW_S$ZZ``!83R(M_^0LE
  2892. XM;```3J[_9"(M_]PL;```3J[_IB!M_[@L>``$3J[_''``3.U,_/^,3EU.=0``;
  2893. XM`_@````,`````0```58```%2```!3````4@```$R```!+@```2@```$@```!U
  2894. XM'````18```-.````;`````````/O@P```E]F<F5E`````````@``!3@```3^I
  2895. XM@P```U]$96QE=&50;W)T``````(```4N```$]H8```-?7T-H:6QD<F5N````\
  2896. XM```"```$F@``!(R#```"7TYE=TQI<W0````!```#RH,```-?0W)E871E4&]R2
  2897. XM=``````!```#*H,```)?;6%L;&]C``````$```,,@P``!%]%<V-A<&53=')IG
  2898. XM;F<````````!```"(H8```)?1$]30F%S90````<```5.```%0@```YH```+`"
  2899. XM```"L````I@```%TA@```U]?;'-E9VUE;G0```````,```+:```"U@```5"#R
  2900. XM```$7T5S8V%P94%D9&ET:6]N<P````(```("````[H,```-?9FEN9'!A=&@`Z
  2901. XM```````!````6(,```1?0W)E871E1F%M:6QY`````````0```$B#```"7U]XY
  2902. XM8V]V9@`````"````.`````J&```"7U]B87-E```````"````-`````8`````/
  2903. XM```#\@```^H````6`````````````````````````````````````&1O<RYL8
  2904. XM:6)R87)Y````````````````````````````````````````````````````)
  2905. XM`````````````````_(```/I````/TY5__B_[```90```$CG`1`F;0`(?@`K.
  2906. XM2__X2&P``"\M__A.N@``4$\K0/_X9PA2AU*M__A@Y$J'9P)4AR`'3-\(@$Y=N
  2907. XM3G5.5?_\O^P``&4```!(YP`P)FT`""1M``P@2RM(__P@;?_\$/P`(BM(__Q*/
  2908. XM$F=L$!)(@`1```IG+@1``!%G#EM`9SY50&<Z44!G-F!`(&W__!#\`"HK2/_\L
  2909. XM(&W__!#\`$4K2/_\8#`@;?_\$/P`*BM(__P@;?_\$/P`3BM(__Q@%B!M__P0A
  2910. XM_``J*TC__"!M__P0TBM(__Q2BF"0(&W__!#\`"(K2/_\(&W__$(0(`M,WPP`8
  2911. XM3EU.=0```_@````!`````0```!P````````#[X,```)?<W1R<&)R:P````$`F
  2912. XM```D@P```E]?>&-O=F8``````@```%`````*A@```E]?8F%S90```````@``,
  2913. XM`$P````&`````````_(```/J`````B(J&PH@```````#\@```^D````;3E7_E
  2914. XM^+_L``!E````(&P``"\H`!!.N@``6$\K0/_\9T8@;```*V@`!/_X(&W_^$J0U
  2915. XM9R`@;?_X4(BQ[?_\9@H@;?_\0J@`%&`*(&W_^"M0__A@V"!M__A*D&:R+RW_;
  2916. XM_$ZZ``!83V"F3EU.=0`````#[X,```-?4F5P;'E-<V<````````!````8(,`-
  2917. XM``)?1V5T37-G``````$````6A@```U]?0VAI;&1R96X```````(````B````3
  2918. XM#H,```)?7WAC;W9F``````$````*A@```E]?8F%S90```````0````8`````J
  2919. XM```#\@```^D````<3E7__+_L``!E````+PY*K```9E1P%'(`+'@`!$ZN_SHI4
  2920. XM0```2H!F!'``8#X@;```6(@O"$ZZ``!!^@``(FP``"*(0I="ITZZ``!03R!L5
  2921. XM```A0``09A(B;```<!0L>``$3J[_+G``8`)P_RQ?3EU.=0```^^#```#7T-R2
  2922. XM96%T95!O<G0``````0```$B#```$7T]R<&AA;D-H:6QD<F5N``````$````Z_
  2923. XM@P```E].97=,:7-T`````0```#:&```#7U]#:&EL9')E;@``````!@```%@`O
  2924. XM``!.````/@```"X````B````$(,```)?7WAC;W9F``````$````*A@```E]?F
  2925. XM8F%S90```````0````8````````#\@```^D````93E7__+_L``!E````2.<`Y
  2926. XM,"9M``@D;0`,3KH``"!L```K:``$__P@;?_\2I!G)B!M__RQRV842JL`'&8(Z
  2927. XM)*L`("`+8!9"DG``8!`@;?_\*U#__</\D@'``3-\,`$Y=3G4``````^^&4
  2928. XM```#7U]#:&EL9')E;@```````0```!Z#```#7T5M<'1Y36]R9W5E`````0``M
  2929. XM`!J#```"7U]X8V]V9@`````!````"H8```)?7V)A<V4```````$````&````V
  2930. XM`````_(```/I````SDY5__R_[```90```$'M``@K2/_\(&W__$J09P98K?_\0
  2931. XM8/(@;?_\+R@`!$AM``AA```&3EU.=4Y5_Y"_[```90```$CG`S`F;0`()&T`7
  2932. XM#$'Y`````$/M_^1P!B+84<C__$JL``!F"DAL``!.N@``6$\@2D/L`"80&+`96
  2933. XM9@9*`&;V9R0@2D/L`"@0&+`99@9*`&;V9Q)(;``J2&P`1$ZZ``!P`&```7IPS
  2934. XM<K`29A!![``\*TC_F"X\```#[F`.0>P`/BM(_Y@N/````^U![``,0^W_H!+8G
  2935. XM9OQ(>``03KH``%A/*T#_G$J`9A)(;`!`2&P`1$ZZ``!P`&```29(;?^@80`!*
  2936. XMJ%A/*T#_X$J`9AI(;`!82&P`1$ZZ```NK?^<3KH``'``8```^B\M_Y@O+?_@E
  2937. XM3KH``%!/(&W_G"%```AF("\*+RW_X$AL`()(;`!$3KH``"ZM_YQ.N@``<`!@V
  2938. XM``#"+P<O+?_@3KH``%!/+`!*AF8L+PHO+?_@2&P`M$AL`$1.N@``(&W_G"ZH"
  2939. XM``A.N@``+JW_G$ZZ``!P`&```(1"ITZZ``!83R!`$B@`"4B!2,$K0?_D<'*P0
  2940. XM$F8&*T;_\&`$*T;_["M&__@O"R\32&W_Y$ZZ``!/[P`,(&W_G"%```QF*DAL%
  2941. XM`.9(;`!$3KH``"Z&3KH``"!M_YPNJ``(3KH``"ZM_YQ.N@``<`!@%"\M_YQ(1
  2942. XM;```3KH``"!M_YP@*``(3.T,P/^`3EU.=4Y5__B_[```90```"\+)FT`""MLT
  2943. XM``#_^"!M__A*D&=6(FW_^"!I``BQRV9`+RW_^$ZZ```@;?_X+J@`"$ZZ``!(8
  2944. XM;?_\(&W_^"\H``Q.N@``3^\`#$J`9@9P_RM`__PO+?_X3KH``"`M__Q@#"!M(
  2945. XM__@K4/_X8*)P_R9M__1.74YU3E7_^+_L``!E````2.<!$"9M``@K2__\($M*Y
  2946. XM&&;\4XB1RR`(T:W__$*G3KH``%A/+@!3K?_\<%@@;?_\L!!F%B`'<@_`@2!L4
  2947. XM`0XB;?_\$K`(`.B/8-PP+`#Z4FP`^GX`/@!3K?_\<%@@;?_\L!!F%B`'<@_`/
  2948. XM@2!L`0XB;?_\$K`(`.B/8-P@"TS?"(!.74YU```#^````!,````!```#(```A
  2949. XM`P0```,````"\````CP```(0```!X@```7@```%&```!#@```.H```#,````T
  2950. XMO@```*X```"6````A@```'0```!H````8@````````/L`````0````(```!0(
  2951. XM`````````^^#```#7U=A:71#:&EL9````````0```G:#```"7U)E;6]V90``;
  2952. XM```!```"6H,```)?061D5&%I;`````$```(4@P```E]#;&]S90```````0``&
  2953. XM`?"#```$7TQA=6YC:$-H:6QD=@````````$```'0@P```U]&:6YD5&%S:P``7
  2954. XM``````(```+4```!H(,```)?9F-L;W-E``````,```)F```!_````8R#```"3
  2955. XM7T]P96X````````!```!9H,```)?9F]P96X```````$```$P@P```E]F<F5E-
  2956. XM````````!0```HP```($```!E````58```$>@P```E]M86QL;V,``````0``!
  2957. XM`-R#```"7V9P<FEN=&8````&```!Z@```8````%.```!%@```/(```">A@``G
  2958. XM`E]?:6]B````````!@```>8```%\```!2@```1(```#N````FH,```)?3F5W8
  2959. XM3&ES=`````$```!L@P```E]?>&-O=F8`````!````K(```(R````0`````J&N
  2960. XM```"7U]B87-E```````$```"K@```BX````\````!@````````/R```#Z@``C
  2961. XM`$4```````````````!P:7!E.G!O<&5N+EA86%@N6%A86%A86%@``'(`=P!PD
  2962. XM;W!E;CH@8F%D(&UO9&4A"@!R`'<`<&]P96XZ($]U="!O9B!M96UO<GDA"@``9
  2963. XM<&]P96XZ(%5N86)L92!T;R!F:6YD(&%N(&%V86EL86)L92!P:7!E+@H`<&]P<
  2964. XM96XZ(%5N86)L92!T;R!O<&5N('!I<&4@96YD(#$@9FEL92`E<R!M;V1E("5S$
  2965. XM"@!P;W!E;CH@56YA8FQE('1O(&]P96X@<&EP92!E;F0@,B!F:6QE("5S(&UO=
  2966. XM9&4@)7,*`'!O<&5N.B!&;W)K(&9A:6QE9`H````P,3(S-#4V-S@Y86)C9&5F*
  2967. XM``````#\``````/L`````0````$```$.`````````_(```/J````!P``````E
  2968. XM``````````````````````````````````/R```#^P```18"<`!W86ET8VAIE
  2969. XM;&0N;P!?7V)A<V4`7U]X8V]V9@!?16UP='E-;W)G=64`7U]#:&EL9')E;@!?-
  2970. XM5V%I=$-H:6QD`'5X;6%I;BYO`%]$3U-"87-E`%]?=69B<P!?7VEO8@!?7V9M?
  2971. XM;V1E`%]#6$)22P!?7T].0E)%04L`7U]0<F]G<F%M3F%M90!?;6%L;&]C`%]?]
  2972. XM97AI=`!?<W1R;F-P>0!?;6%I;@!?97AI=`!?9G!U=',`7V9P=71C`%]?>&UA?
  2973. XM:6X`7U]-15)'140`=6QS96<`7U]L<V5G;65N=`!O<G!H86YC:&EL9')E;BYOT
  2974. XM`%]&;W)B:60`7T1E;&5T95!O<G0`7U)E;6]V90!?1G)E94UE;0!?4&5R;6ETI
  2975. XM`%]/<G!H86Y#:&EL9')E;@!O<G!H86YC:&EL9"YO`%]/<G!H86Y#:&EL9`!LP
  2976. XM875N8VAC+F\`7T-R96%T949A;6EL>0!?9FEN9'!A=&@`7T5S8V%P94%D9&ETG
  2977. XM:6]N<P!?17-C87!E4W1R:6YG`%]#<F5A=&50;W)T`%].97=,:7-T`%]F<F5E>
  2978. XM`%],875N8VA#:&EL9'8`7TQA=6YC:$-H:6QD;`!E<V-A<&EN9RYO`%]S=')PM
  2979. XM8G)K`&5M<'1Y;6]R9W5E+F\`7T=E=$US9P!?4F5P;'E-<V<`8W)E871E9F%MZ
  2980. XM:6QY+F\`8VAI;&1S=&%T=7,N;P!?0VAI;&13=&%T=7,`<&]P96XN;P!?9G!R=
  2981. XM:6YT9@!?9F]P96X`7T]P96X`7V9C;&]S90!?1FEN9%1A<VL`7T-L;W-E`%]!<
  2982. XM9&1486EL`%]P;W!E;G8`7W!O<&5N;`!?<&-L;W-E```!`````0```"P#Z0`$Y
  2983. XM``P`$P`;`"@``0`T`````0`_`$D``@```+0#Z0`0``P`$P!'`%``5P!=`&4`A
  2984. XM;`!V`(0`C`"3`)P`H@"H`*\``0"W`````0"_`0<#Z@``````R`*&``$`OP!0G
  2985. XM`^H````!`,X````!`-D"V0`!````(`/I``D`#``3`.D`&P`H`/$`_0$%`0X`5
  2986. XM`0$7`````0$G`S(``0```!H#Z0`'``P`$P#I`!L`*`#]`04``0$U`````0%".
  2987. XM`W8``@```5L#Z0`.``P`$P%+`5D!8P#-`$<!=`"$`8(!C@`H`/$!EP`"`9X`K
  2988. XM+@`!`:P````!`+\`%@/J``````&Z!5X``@```#\#Z0`#``P`$P'$``(!9```X
  2989. XM``$!=0!&``$`OP`"`^H``````<X%O0`!````&P/I``4`#``3`"@!VP'C``$`2
  2990. XM'`````$![@7Y``$````<`^D`!@`,`!,`*`&.`18!@@`!`4P````!`?T&00`!>
  2991. XM````&0/I``0`#``3`!L`*``!`@L````!`A@&=0`#````S@/I`!``#``3`8X`*
  2992. XM5P(?`(0!EP(H`B\"-0(]`9T"1P).`/T`,P`#`E@`-@`!`F`````!`F@"*``!8
  2993. X6`+\`10/J``````````<#Z@```````/T`B
  2994. X``
  2995. Xend
  2996. Xsize 9472
  2997. SHAR_EOF
  2998. echo "extracting rsbx.lib/uxmain.c"
  2999. sed 's/^X//' << \SHAR_EOF > rsbx.lib/uxmain.c
  3000. X#include <stdio.h>
  3001. X#include <fcntl.h>
  3002. X#include <ios1.h>
  3003. X#include <string.h>
  3004. X#include <stdlib.h>
  3005. X#include <libraries/dos.h>
  3006. X#include <libraries/dosextens.h>
  3007. X#include <proto/dos.h>
  3008. X#include <proto/exec.h>
  3009. X
  3010. X#define MAXARG 256    /* maximum command line arguments */
  3011. X#define QUOTE  '"'
  3012. X#define ESCAPE '*'
  3013. X#define ESC '\027'
  3014. X#define NL '\n'
  3015. X
  3016. X#define isspace(c) ((c == ' ')||(c == '\t') || (c == '\n'))
  3017. X
  3018. X#ifndef TINY
  3019. Xextern int _fmode,_iomode;
  3020. Xextern int (*_ONBREAK)();
  3021. Xextern int CXBRK();
  3022. X#endif
  3023. X
  3024. Xextern void main(int argc, char **argv);
  3025. X
  3026. Xextern char *_ProgramName;
  3027. Xextern struct UFB _ufbs[];
  3028. Xstatic int argc;        /* arg count */
  3029. Xstatic char *argv[MAXARG];    /* arg pointers */
  3030. Xstatic void badarg(char *program);
  3031. X
  3032. X#define MAXWINDOW 40
  3033. X
  3034. X/*
  3035. X * name        _xmain - process command line, open files, and call "main"
  3036. X *
  3037. X * synopsis    _xmain(line, length);
  3038. X *        char *line;    argument string to command
  3039. X *        int  length    length of argument string
  3040. X *
  3041. X * description    This function performs the standard pre-processing for
  3042. X *        the main module of a C program. It accepts a command
  3043. X *        line of the form
  3044. X *
  3045. X *            arg1 arg2 ...
  3046. X *
  3047. X *        and builds a list of pointers to each argument. The first
  3048. X *        pointer is to the program name. For some environments, the
  3049. X *        standard I/O files are also opened, using file names that
  3050. X *        were set up by the OS interface module XCMAIN.
  3051. X */
  3052. X
  3053. X/*
  3054. X * This is a modified umain.c, supplied with the Lattice 5.04 compiler,
  3055. X *    that correctly handles AmigaDos escapes.
  3056. X *
  3057. X *                    Ray
  3058. X */
  3059. X
  3060. Xvoid _xmain(char *line, int length)
  3061. X    {
  3062. X    char *argbuf;
  3063. X    int x;
  3064. X
  3065. X    /*
  3066. X     *
  3067. X     * Open standard files
  3068. X     *
  3069. X     */
  3070. X#ifndef TINY
  3071. X
  3072. X    _ufbs[0].ufbfh = Input();
  3073. X    _ufbs[1].ufbfh = Output();
  3074. X    _ufbs[2].ufbfh = Open("*", MODE_OLDFILE);
  3075. X
  3076. X    _ufbs[0].ufbflg |= UFB_RA | O_RAW | UFB_NC;
  3077. X    _ufbs[1].ufbflg |= UFB_WA | O_RAW | UFB_NC;
  3078. X    _ufbs[2].ufbflg |= UFB_RA | O_RAW | UFB_WA;
  3079. X
  3080. X    stdin->_file  = 0;
  3081. X    stdout->_file = 1;
  3082. X    stderr->_file = 2;
  3083. X
  3084. X    x = (_fmode) ? 0 : _IOXLAT;
  3085. X    stdin->_flag  = _IOREAD | x;
  3086. X    stdout->_flag = _IOWRT  | x;
  3087. X    stderr->_flag = _IORW   | x;
  3088. X
  3089. X    /* establish control-c handler */
  3090. X
  3091. X    _ONBREAK = CXBRK;
  3092. X
  3093. X#endif
  3094. X
  3095. X    if (!(argbuf = malloc(_ProgramName[-1] + length + 2)))
  3096. X        {
  3097. X        _exit(1);
  3098. X        }
  3099. X
  3100. X    argv[argc++] = argbuf;
  3101. X    strncpy(argbuf, _ProgramName, _ProgramName[-1]);
  3102. X    argbuf += _ProgramName[-1];
  3103. X    *argbuf++ = '\0';
  3104. X
  3105. X    /*
  3106. X     *
  3107. X     * Build argument pointer list
  3108. X     *
  3109. X     */
  3110. X    while (argc < MAXARG)
  3111. X        {
  3112. X        while (isspace(*line) && length)
  3113. X            {
  3114. X            line++;
  3115. X            length--;
  3116. X            }
  3117. X        if (!length)
  3118. X            {
  3119. X            break;
  3120. X            }
  3121. X        argv[argc++] = argbuf;
  3122. X        if (*line == QUOTE)
  3123. X            {
  3124. X            line++;
  3125. X            length--;
  3126. X            while (length && (*line != QUOTE))
  3127. X                {
  3128. X                if (*line == ESCAPE)
  3129. X                    {
  3130. X                    line++;
  3131. X                    length--;
  3132. X                    if (!length)
  3133. X                        {
  3134. X                        badarg(*argv);
  3135. X                        }
  3136. X                    else
  3137. X                        {
  3138. X                        switch (*line)
  3139. X                            {
  3140. X                            case 'E':
  3141. X                                *argbuf++ = ESC;
  3142. X                                break;
  3143. X                            case 'N':
  3144. X                                *argbuf++ = NL;
  3145. X                                break;
  3146. X                            default:
  3147. X                                *argbuf++ = *line;
  3148. X                            }
  3149. X                        length--;
  3150. X                        line++;
  3151. X                        }
  3152. X                    }
  3153. X                else
  3154. X                    {
  3155. X                    *argbuf++ = *line++;
  3156. X                    length--;
  3157. X                    }
  3158. X                }
  3159. X
  3160. X            if (!length)
  3161. X                {
  3162. X                badarg(*argv);
  3163. X                }
  3164. X
  3165. X            line++;
  3166. X            length--;
  3167. X            *argbuf++ = '\0';    /* terminate arg */
  3168. X
  3169. X            if (length && !isspace(*line))
  3170. X                {
  3171. X                badarg(*argv);
  3172. X                }
  3173. X            }
  3174. X        else  /* non-quoted arg */
  3175. X            {
  3176. X            while (length && (!isspace(*line)))
  3177. X                {
  3178. X                *argbuf++ = *line++;
  3179. X                length--;
  3180. X                }
  3181. X            if (!length)
  3182. X                {
  3183. X                *argbuf = '\0';
  3184. X                break;
  3185. X                }
  3186. X            else
  3187. X                {
  3188. X                *argbuf++ = '\0';    /* terminate arg */
  3189. X                }
  3190. X            }
  3191. X        }  /* while */
  3192. X
  3193. X    /*
  3194. X     *
  3195. X     * Call user's main program
  3196. X     *
  3197. X     */
  3198. X
  3199. X    main(argc, argv);    /* call main function */
  3200. X#ifndef TINY
  3201. X    exit(0);
  3202. X#else
  3203. X    _exit(0);
  3204. X#endif
  3205. X    }
  3206. X
  3207. X
  3208. Xstatic void badarg(char *program)
  3209. X    {
  3210. X    fputs("Invalid argument to ", stderr);
  3211. X    fputs(program, stderr);
  3212. X    fputc('\n', stderr);
  3213. X    exit(100);
  3214. X    }
  3215. SHAR_EOF
  3216. echo "extracting rsbx.lib/childtasking.h"
  3217. sed 's/^X//' << \SHAR_EOF > rsbx.lib/childtasking.h
  3218. X/*
  3219. X * ChildTasking.h
  3220. X */
  3221. X
  3222. X#include <exec/types.h>
  3223. X#include <exec/lists.h>
  3224. X#include <exec/ports.h>
  3225. X#include <libraries/dos.h>
  3226. X
  3227. X
  3228. Xstruct ProcessTreeNode
  3229. X    {
  3230. X    void (*Orphan)( void );
  3231. X    struct MinList ChildList;
  3232. X    struct MsgPort *Morgue;
  3233. X    };
  3234. X
  3235. Xstruct DeathNotice            /* termination message from child */
  3236. X    {
  3237. X    struct Message msg;
  3238. X    struct DeathNotice **noticeptr;    /* process ID of sending task    */
  3239. X    long ret;            /* return value                  */
  3240. X    };
  3241. X
  3242. Xstruct ChildNode
  3243. X    {
  3244. X    struct MinNode node;
  3245. X    struct DeathNotice notice;
  3246. X    };
  3247. X
  3248. Xstruct StartMsg                /* startup message sent to child */
  3249. X    {
  3250. X    struct Message msg;
  3251. X    char *command;            /* command line                  */
  3252. X    ULONG cmdlen;            /* command line length           */
  3253. X    struct Library *DOSBase;    /* DOS lib pointer               */
  3254. X    struct MsgPort *morgue;        /* message port for parent       */
  3255. X    struct DeathNotice *termmsg;    /* child's termination message   */
  3256. X    BPTR st_fh1;            /* filehandle for child to close */
  3257. X    BPTR st_fh2;            /* filehandle for child to close */
  3258. X    };
  3259. X
  3260. Xstruct LAUNCHENV
  3261. X    {
  3262. X    long priority;    /* priority for child process          */
  3263. X    ULONG stack;    /* stack size for child process.       */
  3264. X            /*  If zero, stack size of calling     */
  3265. X            /*  process will be used.              */
  3266. X    BPTR std_in;    /* AmigaDos filehandle for child's     */
  3267. X            /*  Input() stream. If zero, Input()   */
  3268. X            /*  stream of calling process used.    */
  3269. X    BPTR std_out;    /* AmigaDos filehandle for child's     */
  3270. X            /*  Output() stream. If zero, Output() */
  3271. X            /*  stream of calling process used.    */
  3272. X    BPTR console;    /* console window handler port for     */
  3273. X            /*  child.                             */
  3274. X    BPTR le_fh1;    /* AmigaDos filehandle for child to    */
  3275. X            /*  close at exit.                     */
  3276. X    BPTR le_fh2;    /* AmigaDos filehandle for child to    */
  3277. X            /*  close at exit.                     */
  3278. X    };
  3279. X
  3280. X
  3281. Xextern struct ProcessTreeNode *_Children;
  3282. X
  3283. Xstruct ChildNode *LaunchChildl(struct LAUNCHENV *envp, char *name, char *args, ...);
  3284. Xstruct ChildNode *LaunchChildv(struct LAUNCHENV *envp, char *name, char **argv);
  3285. Xvoid EmptyMorgue( void );
  3286. Xstruct ChildNode *WaitChild(struct ChildNode *child, long *status);
  3287. Xstruct ChildNode *ChildStatus(struct ChildNode *child, long *status);
  3288. Xint OrphanChild(struct ChildNode *child);
  3289. Xvoid OrphanChildren( void );
  3290. Xint CreateFamily( void );
  3291. SHAR_EOF
  3292. echo "extracting rsbx.lib/launchc.obj.uu"
  3293. sed 's/^X//' << \SHAR_EOF > rsbx.lib/launchc.obj.uu
  3294. X
  3295. Xbegin 640 launchc.obj
  3296. XM```#YP````-L875N8VAC+F\```````/H`````````^D```%;3E4``+_L``!E.
  3297. XM````2.<`,"9M``@D;0`,2&T`$"\*+PMA```,3.T,`/_X3EU.=4Y5_["_[```C
  3298. XM90```$CG/S(F;0`()&T`#$ZZ``!*@&8&<`!@``40+PI.N@``6$\K0/_@4H!G+
  3299. XM``3\(`MF!$?L``"3R2QX``1.KO[:*T#_P$JK``1F$"!M_\`@*``^D*@`.B=`D
  3300. XM``0,JP``(```!&0*(#P``"``)T``!"`K``16@`)`__PG0``$?@%\`"`'Y8`@H
  3301. XM;0`02K`(`&<Z(`?E@"!M`!`@<`@`2AAF_%.((FT`$)'Q"``@!^6`+S$(`"](4
  3302. XM`"A.N@``6$\B+P`DTH!2@=R!4H=@N$J&5\!$`$B`2,!2ADJ`9P)2ACE\``0`6
  3303. XM-G``*4``."E&`#PI?``!``$`0'!`*4``1$*L`$@B;0`0(%%*&&;\4XB1T2`(E
  3304. XM5(`I0`!,0JP`4"EL````5$'L`"@L>``$3J[_(BM`_[@@+?^X"```'V<0(BW_<
  3305. XMX"QL``!.KO^F8``#Y"!M_[@K:``0__P@;?^X*V@`&/^T(FW_N"!I`"`K2/_8=
  3306. XM(&W_N"MH`"C_["`M_]@B`.2!(&W_M"%!`!`@;?_84JW_V"QM`!`B5DH99OQ3Z
  3307. XMB9/6(`D0@")M`!`@42)M_]@2V&;\?@%\`"`'Y8`@;0`02K`(`&<``((@!^6`(
  3308. XM(&T`$"\P"`!.N@``6$\J`$J%9QP@;?_\T<8@!^6`(FT`$"\Q"``O"$ZZ``!0P
  3309. XM3V`6(&W__-'&(`?E@")M`!`B<0@`$-EF_"`'Y8`@;0`0('`(`$H89OQ3B")MD
  3310. XM`!"1\0@`(`C0A=R`($92AB)M__P@"!.\`"`(`%*'8`#_<DJ&9P)3AB!&4H8BV
  3311. XM;?_\(`@3O``*"``@;?_\0C!H`"(M_^`L;```3J[_@BM`_^`B`$ZN_Z`K0/_<C
  3312. XM(@HL;```3J[_:BM`_^0B+?_@+&P``$ZN_X(B`$ZN_Z9*K?_D9P`"=B`L``!!#
  3313. XM[```(FW_[&`"$MA3@&3Z(&W_["M(_^A8K?_H(&W_Z""M_^0@+?_HY(`K0/_HO
  3314. XM2'@`,$ZZ``!83RM`_\Q*@&<``B0@;?_,,7P`'``20J="ITZZ``!03R!M_\PA1
  3315. XM0``.9P`!^B!M_\PA;?_\`!0@;?_,(48`&$/L`!QP`"QX``1.KOW8(&W_S"%`I
  3316. XM`!QG``'`<"1R`"QX``1.KO\Z*T#_U$J`9P`!FB!M_]10B")M_\PC2``D("W_>
  3317. XMZ"(*)@`D$R@K``0L;```3J[_=BM`_]!*@&<``5X@;?_0*V@`$/^\(&W_O$JH/
  3318. XM`$IF$"!M_[S0_`!*+PA.N@``6$\@;?^\T/P`2B)M_[@L>``$3J[_"B!M_[PA^
  3319. XM;?_<`)@@;?_`(FW_O"-H`*@`J"`M_[3D@"!M_[PA0`"L2JL`$&<:("L`$.6`0
  3320. XM*T#_Q"!M_\0B;?^\(V@`"`"D8`X@;?_`(FW_O"-H`*0`I$JK``AG#"!M_[PAO
  3321. XM:P`(`)Q@#B!M_\`B;?^\(V@`G`"<2JL`#&<,(&W_O"%K``P`H&`.(&W_P")M3
  3322. XM_[PC:`"@`*`@;?_,(6L`%``H(&W_S"%K`!@`+"!L```B;?_,(V@`$``@(&P`[
  3323. XM`%B((FW_U"QX``1.KO\*(&W_T")M_\PL>``$3J[^DB!M_\P@:``.+'@`!$ZNK
  3324. XM_H`K0/_(L*W_S&<8(&W_S"!H``XL>``$3J[^C")`3J[^AF#.(&W_S"\H``Y..
  3325. XMN@``+JW_S$ZZ```@+?_48%PB;?_4<"0L>``$3J[_+B)M_\PB:0`<+'@`!$ZNP
  3326. XM_F(@;?_,+R@`#DZZ``!83R\M_\Q.N@``6$\B+?_D+&P``$ZN_V0B+?_<+&P`-
  3327. XM`$ZN_Z8@;?^X+'@`!$ZN_QQP`$SM3/S_C$Y=3G4```/X````#`````$```%6M
  3328. XM```!4@```4P```%(```!,@```2X```$H```!(````1P```$6```#3@```&P`&
  3329. XM```````#[P$```1?3&%U;F-H0VAI;&1L``````````$```1?3&%U;F-H0VAI4
  3330. XM;&1V````````+H,```)?9G)E90````````(```4X```$_H,```-?1&5L971ES
  3331. XM4&]R=``````"```%+@``!/:&```#7U]#:&EL9')E;@```````@``!)H```2,T
  3332. XM@P```E].97=,:7-T`````0```\J#```#7T-R96%T95!O<G0``````0```RJ#'
  3333. XM```"7VUA;&QO8P`````!```##(,```1?17-C87!E4W1R:6YG`````````0``8
  3334. XM`B*&```"7T1/4T)A<V4````'```%3@``!4(```.:```"P````K````*8```!Y
  3335. XM=(8```-?7VQS96=M96YT```````#```"V@```M8```%0@P``!%]%<V-A<&5!:
  3336. XM9&1I=&EO;G,````"```"`@```.Z#```#7V9I;F1P871H`````````0```%B#A
  3337. XM```$7T-R96%T949A;6EL>0````````$```!(@P```E]?>&-O=F8``````@``-
  3338. XM`#@````*A@```E]?8F%S90```````@```#0````&`````````_(```/H````_
  3339. XM`E]?34521T5$```#Z@```!8`````````````````````````````````````W
  3340. XM9&]S+FQI8G)A<GD`````````````````````````````````````````````I
  3341. X3```````````````````````#\@``U
  3342. X``
  3343. Xend
  3344. Xsize 2044
  3345. SHAR_EOF
  3346. echo "extracting rsbx.lib/ulseg.obj.uu"
  3347. sed 's/^X//' << \SHAR_EOF > rsbx.lib/ulseg.obj.uu
  3348. X
  3349. Xbegin 640 ulseg.obj
  3350. XM```#YP````)U;'-E9P```````^@````"7U]-15)'140```/J````4````4``I
  3351. XM````8!0``````````````````````````$CG?_XL>``$D\E.KO[:*$!![`!<I
  3352. XM3J[^@$'L`%Q.KOZ,(D!%^O_()6D`*``,)6D`+``0)6D`(``$)6D`'```)6D`G
  3353. XM)``(0>H`""10)4@`%"!I`!0@*0`82.>`@$ZN_H8B;`"`5HG3R=/)(KK_?$/ZZ
  3354. XM_W0@*0`$Y8A8@")`3-\!`2(L`#HD#P2"````%)2!+RP`L$CG``HO`BE/`+!.I
  3355. XMD5B/3-]0`"E?`+`O`$7Z_T(B.O\X+PXL:@``3J[_9"Q?(BP`F"\.+&H``$ZN?
  3356. XM_Z8L7R(J``QG#"\.+&H``$ZN_]PL7R(J`!!G#"\.+&H``$ZN_]PL7R)J``!..
  3357. XMKOYB3J[_?"`J``AG&B)`(U\`&$*I`!1"J0`.(&H`!")J``A.KOZ23-]__DYUE
  3358. X@```#[P$```-?7VQS96=M96YT`````````````````_)JR
  3359. X``
  3360. Xend
  3361. Xsize 392
  3362. SHAR_EOF
  3363. echo "End of archive 14 (of 14)"
  3364. # if you want to concatenate archives, remove anything after this line
  3365. exit
  3366.